Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Transfering Item From One Listbox To Anotehr Listbox On Click


Hi all i got 2 listbox . I want to be able to click on my first listbox items and once i click on them it transfers to the second listbox. Could any one tell me how that can be done.Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Making Right-Click In A ListBox Select An Item Exactly Like The Left Click.
Heres a start:


Code:
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'Place code to select the item
End Sub

I need help where the comment is. Thanks

Click On An Item In A Listbox
Hey guys I have a listbox called list 2, how would I get it so when i click on a single item in the listbox it gets added to another listbox called list3?

I can see clicking on a item in a listview would be like this..
VB Code:
Dim i As Integer        Dim lstItem As ListItem       ' List1.Clear    List1.Refresh        For i = lvwFound.ListItems.Count To 1 Step -1   If lvwFound.ListItems(i).Selected = True Then       ' by including the index at end of next statement, items are placed       ' in List1 top down vs bottom up in relation to lvwFound       List1.AddItem lvwFound.ListItems(i).Text, 0       Form2.lvwFound.ListItems.Remove i       Ignore.lvwFound.ListItems.Remove i   End IfNext


Thanks!

Solved-howto Send First Item Of Listbox Totextbox, Then Delete First Item Of Listbox?
Lol another question, how do you do this

how to send first item of listbox to textbox, then delete first item of listbox?

Thanks

ListBox - Remove Item On Click
OK, I have created a listbox that holds string data, te functionality i want, si that when the user clicks on one of the items in the list, it is removed.


Code:
Private Sub lstReportSites2_Click()

lstReportSites2.RemoveItem (lstReportSites2.ListIndex)

End Sub
The problem seems to be, once the item is removed the 'click' event is triggered again, and it tries to delete the next item, but then errors.

Is there another way to do this?

Selecting Item In Listbox With Right-click
Hi,

Is it possible to select a item in a listbox with a right-click of the mouse. I have a popup menu that must run when the right mouse button is clicked on a item in the listbox.

The problem is that the item is not selected when I right-click on it. The popup menu displays 100% but the item stays unselected. I first have to left-click on the item to select it and then right-click to popup the menu.

Bezzie

Simulating A Click On A Listbox Item
I have about 90 items in a listbox. When they are clicked they bring up a text file. I have a function elsewhere in the program which edits the files, this includes renaming them. How can I then select one of them as though it has been clicked so it is selected and the appropriate textfile is opened?

Right Click Item Is ListBox And Display Options
HI,

I am using the ListBox in VB6. In this listbox, I am displaying all of my information in a sorted order. At the bottom of the Listbox, I display a summary of the specific items from above in the list box. Want I am looking to do is from the Summary at the end of the Listbox, I want to right click on an item, and have the option to go to where this item is located from the sorted information above.

Basically, I wanted to see if if possible to right click on an item and have options (i.e cut, paste, goto). I saw something about a ContextMenu??? Is this what I need to look at, or is this for vbnet?

Thanks

Select An Item Of A Listbox Using The Right Mouse Click
Hi ALL,
i am trying to create a right mouse click to popup a menu, and select the item that i right click on also.

for the popup menu , i have done it .

but i do not know how to select the item at the same time. can anyone help me.

thanks.

Right Mouse Click Select Listbox Item
I have a listbox with a bunch of entries. I have a right mouse click popup menu which does some things, one of which is to delete the selected item. The problem is that I have to left mouse click to select the item, then right mouse click to popup my menu. How can I select the item and popup my menu all with one right mouse click?

Selecting Listbox Item With Right Click (Resolved)
I have a listbox and a file list box on a form. This problem applies to both of them.

When the user right clicks on the listbox I popup a menu with some options to preform on that item. The problem is that right clicking on a list box doesn't select anything. In order to make it work the user has to left click to select the item and then right click to get the menu. I just want the user to be able to right click.

Thanks!

Hmm, Tricky... How Do I Click On A Listbox Item In Another Apps Window?
Hi,

How can i click a list item of a list box of another apps window? I want to click the list item which has the text "Smat Security". How can i do this?

Thanx

Select Item Without Firing Listbox Click Event
Hi,

I have code on a listbox click event. I want this code to work on a user click only, not when I select items in the code like "listbox1.selected(i)=true"


How can i do this?

Right Click To Return Index And Select ListBox Item.
How can I make a right mouse click return the ListIndex and select a ListBox item?

Below code doesn't won't return the ListIndex.

Code:If Button = vbRightButton Then
        MsgBox "Item Index " & List1(Index).ListIndex & " " & "List Index " & Index
End If
Thanks!

ddutke

Transfering Info From Listbox To Listbox
How can I assign the information in one list box to another.

Populate A Listbox Based On A Selected Item In Another Listbox
Ok...I am stumped.

I have a single form that has 3 list boxes. I have 4 public strings containing various values. Based on the selection from lstBox1, I need to populate the ListBox2 and ListBox3 list from values in the public strings. Clear as mud?? That is what I thought!

Example string variable

strLuxury = """Hand Wash"" ""Hand Wax"" ""Check Engine Fluids"" ""Detail Engine Compartment"" ""Detail Under Carriage"" ""Fragrance"" ""Shampoo Carpets"" ""Shampoo Upholstery"" ""Scotchgard"""

ListBox1 contains the following:

Standard
Deluxe
Executive
Luxury

ListBox2 is empty, but is contained in a frame indicating Exterior Options
ListBox3 is empty, but is contained in a frame indicating Interior Options

If Luxury is selected in ListBox1, then ListBox2 should contain
Hand Wash
Hand Wax
Check Engine Fluids
Detail Engine Compartment
Detain Under Carriage

And ListBox3 should contain
Fragrance
Shampoo Carpets
Shampoo Upholstery
Scotchgard

If Fragrance is present in ListBox3, a seperate dropdown box should appear allowing selection of the appropriate scent.

Yes, this is a homework assingment.

Thank you in advance for your help!
Mark

Listbox: How To Know Last Added Item's Index, When The Listbox Is Sorted?
When sorted property of a listbox is set to True, each new item added won't be at the end of the list, it will be automatically placed in the correct index, according to text order, is there a way to know which is the index of that item (last item added)? Looping to find it would be horrendous, I just need the index to mark that item selected.

How To Add A Listbox Item To A Listbox On Another Form Within The Project.
What is the best method to take an item selected in a listbox and add it to another listbox on a different form within the same app?

.: Please Help: Copy Selected Item(s) From A ListBox To The Other ListBox..
Hi everyone!

I'm having problem with copying file to another Listbox, please help..
So, in this case, I have two ListBoxes where the 1st ListBox holds several items..
I need to copy the selected item to the other listbox 'without' a repetition, I mean.. the same item won't copied anymore..
When the user tries to copy the item which have already been in the ListBox2, then a messagebox will pop up to warn the user of the existing item.... So, how should I do that??


Thanks a lot

Pass Value From Listbox To Textbox When Single Click On Value In Listbox
Hi there,

I have a form with a listbox and a textbox.

The listbox is populated by an sql query.


When the user single clicks (highlights) an item in the listbox, I want the value they have hightlighted/selected to be passed and stored in the textbox.


Anyone know how I can do this?


Thanks

Pass Value From Listbox To Textbox When Click On Value In Listbox
Hi there,

I have a form with a listbox and a textbox.

The listbox is populated by an sql query.


When the user single clicks (highlights) an item in the listbox, I want the value they have hightlighted/selected to be passed and stored in the textbox.


Anyone know how I can do this?


Thanks

Transfering Information From One Listbox To Another
I am trying to transfer items from one listbox to another, anyone any ideas.
My first istbox as 5 items i what to allow the user to select an item on selecting a button transfer the selected item into another listbox.

Thanks

Transfering Data From ListBox To A Label
Hi there,

I am doing an assignement with VB and i am having a bit or trouble. I have searched the forums to try and find a solution but i can't seem to find exactly what I want.

Here is my problem:

I have a ListBox containing the names of children in a class.

I have some labels across from this list box where their parents names will be put in.

What I want to do is, when an name in the list box is clicked, say John Smith, then his parents names come up in the two seperate labels.

simple for you lot i know, but i am stuck really bad :S

Transfering Content Of Listbox To Textfile
hi everyone,
how can i transfer the content of the listbox to a textfile?
tanks in advance.....

Moving Listbox Item To Another Listbox
hi does anyone know of an easy way to move an item in a listbox to another listbox, lets say a source and target listbox and vice versa. thanks

Adding An Item From One Listbox To Another Listbox
I have several forms, one with a listbox that displays the selected records of a field from a database. I select(click) one of those records and want to have another particular field from that record display in another listbox on another form. So far it works with this code, but pulls all the records from the first listbox.
To be more specific, the database has populations and zip codes, etc. The field for population is called pop2001 and the zip codes is Zip. The listbox with the selected records displays zipcodes and I want to select one of those zipcodes and have it's population display in the other forms listbox, but it displays all of them. Can anybody help?


Code:
Private Sub Form_Load()

PopRecSet.MoveFirst
Do Until PopRecSet.EOF
frmpopfinal.lstpopfinal.AddItem PopRecSet![pop2001]
PopRecSet.MoveNext
Loop


End Sub

Listbox Name Showing Up As First Item In Listbox?
For some reason the listbox I've just added to my form shows the name of the listbox in itself at design time. At run-time, the name of the listbox shows up as the first item in the list.

I've tried looking for a CAPTION or TEXT property but neither seem to be present. Any ideas as to how to fix this?

Drag Item From Listbox To Listbox
I was wondering how to drag one item from one listbox to another listbox on the same form...
By using drag and drop, not by using any button..
I choose an item by pressing and holding the button and then drag it to the other listbox..

Also,How do I drag a file from outside my app and into the listbox?
How to use the drag and drop (onto apps listbox) function?

Please provide a simple example(form) if you can
PS: Do it as simple as possible!! No need for extra's!!

I need more help, The examples below didnt work correctly!

How To Search Listbox For Item If Item Not Found Add Item?
Hi, lol man I cant find nothing today when I search the forum.

This my latest problem, How do I search a listbox for an item lets say "Game Over" And if the item is found the program does nothing, but if the item is not found it will add "Game Over"

Thanks Again

Removing An Item From A ListBox By Clicking The Item
Hi, How do you remove an item from a ListBox by simply clicking the item u want to be removed?

This is the code i tried but it doesnt work:

Private Sub list1_Click()
Dim n As Long
Dim ncount As Long

ncount = List1.ListCount - 0
For n = 0 To ncount
List1.RemoveItem (n)
Next
End Sub

Any ideas?


-Flaw

Last Item In A Listbox
A listbox normaly shows items 1 down to the maximum showable in that box despite of the value of .ListCount . How can I tell VB - after aplying the .AddItem-method - allway to show the .ListCount-item at the last line of the listbox (will say: display items [.ListCount-max. lines] to .ListCount)?

Thanks in advance!

Lightgun

For Each Item In Listbox...
Here is what im Trying to do:

Something like....

For Each Item in Listbox

MsgBox The Data of the item

Next

Its so simple, yet i havnt been able to figure it out =/

Listbox Item Taken Out
Hey, i also need to know how to take away an item from a list. so say i had lstMyList.additem myPerson.name

i would want to take away myPerson.name when i did a certain thing

does anyone know? thanks...Xtrava

Listbox Item
Is it possible to have some kind of short textstring shown with some information when you have the mousepointer over an item in a list box??

If I have the mouse of item 1 it might say "bla bla bla" and if I move it over item 2 "tada tada"

Add Item To ListBox
I'm trying to write a winsock program (but the actual problem doesn't have anything [at least I don't think] to do with Winsock, so I'm posting here). It is a LAN based IM system, and on the server side, it has a list box with connected users. What I'm trying to do is to add the user based on the index of the Winsock object, but I get an "Invalid Procedure Call or Argument" error on that line.

lstUsers.AddItem user(0), Index

user(0) is the user's name, and Index is the Index of the Winsock Object. When I comment out/take out the ", Index" part, the program rusn with no error. Where did I go wrong?

Listbox Value For An Item
I am populating a listibox with items. Is it possible to populate it like a combo in a html form?

I have a list of athlete's and when seleted I want to pull the ID for the athlete. I can already pull the text that is displayed but hoping I can add additional info like in a html combo and when selected display the other info.


VB Code:
...Do While adoRs.EOF = False            lstAvailable.AddItem adoRs.Fields.Item("ATHLETE_NAME").Value            adoRs.MoveNextLoop...


Update: Sorry, I said listview originally, I meant to say listbox.

Thanks for your help in advance.

ListBox Item
I have got a list box on a form, and I'm saving data into an Access Table like this, if 2 options are chosen, I place the first item in the field then I use a (comma), and then place the other option and so on.

Now I want to reverse it and do something like this, want to read that field and whenever it finds a comma , it should place the data in the next line. And I want to put the results in MsgBox and if I have these three items saved in the table: PS2, Newspaper, XBox...I would like them to appear in the MsgBox like This:
PS2
Newspaper
xBox

Any help on that?

Item From Listbox
Hi all,
I'm using a listbox which is containing around 100 items and the contents of listbox are changing after regular intervals. If a user selets an item from listbox, how can i get the name of the selected item?
Help me pls.
Anita.

Listbox ? How Much Item Can I Add ?
i m trying to add items to my listbox and i think that it has a limit of a 32767 items can that happen ?
10x

Each Item In A Listbox
I am trying to step through each item in a listbox, starting with the first item and making my way through each of them. I will be writing the contents of each item to a binary file (I've got all the code for that..). However, I can't seem to figure out how to step through each item in the list box and get its text value. Any suggestions? Thanks in advance!

For Each Item In Listbox...
In vb.net I have a listbox that contains the path to files. Then I used a For Each loop to add each file to the a zip archive. How can I do this in vb 6.0?

VB.net code:
For Each file In ListBox1.Items
'code
Next

Thanks for any help you can provide
Dave

Last Item In Listbox
I want to make it so that when the last item is selected in my listbox a message box is displayed. The amount of items in the listbox may vary so i dont know how many items will be in the list. Can someone please help.

Move ListBox Item Up Or Down
Just wanted to make a small contribution to the forum. I looked around for this but didn't find anything really to my liking, so here's my version...


Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Move Selected listbox item up or down
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
const UP as integer = -1
const DOWN as integer = 1

Private Sub btnUp_Click()

If Me.lstDisplayCols.ListCount > 1 Then
Call MoveListItem(UP, Me.lstDisplayCols)
End If

End Sub

Private Sub btnDown_Click()

If Me.lstDisplayCols.ListCount > 1 Then
Call MoveListItem(DOWN, Me.lstDisplayCols)
End If

End Sub

Private Sub MoveListItem(ByVal intDirection As Integer, _
ByRef lstListBox As ListBox)

Dim intNewPosition As Integer
Dim strTemp As String

intNewPosition = lstListBox.ListIndex + intDirection
strTemp = lstListBox.List(intNewPosition)

If intNewPosition > -1 _
And intNewPosition < lstListBox.ListCount Then

'Swap listbox items
lstListBox.List(intNewPosition) = lstListBox.Text
lstListBox.List(intNewPosition - intDirection) = strTemp
lstListBox.Selected(intNewPosition) = True

End If

End Sub

the lstDisplayCols listbox is a list of selected columns to be displayed for a search result list. Just put the name of your list box there...

How To Get The Text Of Item In A Listbox?
I am using a test tool that uses VBA as its back end. When I record the action the tool itself only recongnizes the NAME of the item selected in the list...in most cases this is best.

However, I really need it to select by text, but this does not seem to work. So I want to write a little VBA that will extract the text of the displayed selection in the listbox after my test tool plays back the selection.

Example:
the text displayed is "English"
the name of this item is "en-US"

I want:
textDisplayed = text.listbox, which will mean textDisplayed = "English"

I was wondering what the syntax for this is? rather new to VB.

Thanks in advance

Listbox Item Selection
Is there a way to select one item or a range of items in a listbox? Also, is there a way to deselect the currently selected items in the listbox?

Remove Item From Listbox
Hi

Please can someone help me, here is what i have a 1 textbox and 1 listbox, the listbox is populated from a field in the access database, all good so far. but i need to remove a specific item from the listbox, eg. the listbox is populated with table numbers "Table 1" to "Table 50" the textbox is connected to the database so if i move to "Table 5" in the textbox and click remove it is removed from the database but not from the listbox, so basicall i need to remove a table that i select from the textbox and the corresponding table number in the listbox must be removed, and cant quite figure it out, here is what i am trying.

Private Sub Command1_Click()
Dim MyTest As Integer
MyTest = Text1.Text
List1.RemoveItem MyTest
End Sub

Please can someone give some advise.

Many thanks in advance

Remove Item From Listbox
In the list box, I want to remove selected items and retain the other items in the same positions in which they existed before removal.
For example, consider a listbox having 10 items. Suppose I remove the 7th item, 8th, 9th & 10th items should remain in the same position. 8th to 10th items should not move up in the list. 7th item will not have any values.
How can this be done?

Removing An Item In A Listbox
When selecting an item in a listbox and clicking Go_click(), to remove that item, is the code just


Code:
Private Sub Go_Click()
List1.RemoveItem List1.ListIndex
End sub

It seems to work, but, should there be more?

Listbox+For Each Item+Pause
Ok, guys, i need help. I have one listbox, populated with irc #channels, and i want bot to come and enter in each channel in listbox, then to say some text (i use this for my irc server, for annoucments), and part that channel after saying a message.
I got how to do that, but i have a problem. It comes to "exces flood" and i am being disconected from server.
How can i eventually pause some events? U know, it joins to channel, than says a message, parts that channel, waits for a couple a seconds (for exam. 3 seconds) than joins other channel in list and so on??


Code:
On Error Resume Next
Dim i As Integer

For i = List1.ListCount - 1 To 0 Step -1
Winsock1.SendData "JOIN " + List1.list(i) + vbCrLf
Wait 5000 (its says to wait 5 seconds, than to do next)
Winsock1.SendData "PRIVMSG " + List1.list(i) + " :" + "xax" + vbCrLf
Wait 5000 (its says to wait 5 seconds, than to do next)
Winsock1.SendData "PART " + frmLISTAKANALA!List1.list(i) + vbCrLf

Next i
End sub
Greetings from Bora.

Formating A Listbox Item
I have created a listbox in VB. It lists all of the sheets in my current workbook. When I click on the name of one of the sheets, it switches to that sheet. It works really nicely. I am trying to figure out a way, when the listbox comes up, to BOLD the name of the active sheet.

I am not sure it is possible to format the text for a particular line in the listbox.

Copyright © 2005-08 www.BigResource.com, All rights reserved