Hi This is vivek,
This is my code which i used to try this but it inserts only the last value in the listbox but i need all the selected values seperated by comma can any one help me
For i = 0 To ListBox1.SelectedItems.Count - 1
list = ListBox1.SelectedItems.Item(i) + ","
Next
To store multiple selected values in a single field from listbox in vbim using MS Access as database
Page 1 of 1
2 Replies - 3064 Views - Last Post: 07 July 2010 - 04:24 AM
#1
To store multiple selected values in a single field from listbox in vb
Posted 06 July 2010 - 12:56 AM
Replies To: To store multiple selected values in a single field from listbox in vb
#2
Re: To store multiple selected values in a single field from listbox in vb
Posted 06 July 2010 - 04:16 AM
Two things I see, first, you need to append to list, otherwise you are just overwriting it and second you should really use & in VB.Net for appending try this:
the list &= is the same as using list = list & which is basically saying, whatever is in the list variable, save it and append to it.
Hope this helps
For i = 0 To ListBox1.SelectedItems.Count - 1 list &= ListBox1.SelectedItems.Item(i) & "," Next
the list &= is the same as using list = list & which is basically saying, whatever is in the list variable, save it and append to it.
Hope this helps
#3
Re: To store multiple selected values in a single field from listbox in vb
Posted 07 July 2010 - 04:24 AM
thank u charlie,
i got it its working now i have another problem.
im having a access table with sitename as a field which stores the value from listbox as u said. Now i need to load the other details in grid comparing the sitename.As while selecting the Sitename in combobox the corresponding other details such as name,id,salary,etc., have to be displayed. I dont know how to start can u help me.
i got it its working now i have another problem.
im having a access table with sitename as a field which stores the value from listbox as u said. Now i need to load the other details in grid comparing the sitename.As while selecting the Sitename in combobox the corresponding other details such as name,id,salary,etc., have to be displayed. I dont know how to start can u help me.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|