how to get multiselect selectedvalue from listbox in vb.net window application?

T

Tony Dong

Hi there

I have one multiselect listbox, and get date from database using DataSet

HolidaysListBox.ValueMember = "HolidayDate"
HolidaysListBox.DisplayMember = "HolidayName"
HolidaysListBox.DataSource =
HolidayDS.Tables("dtHolidays").DefaultView

if I use one selected, it is working fine and I can get result using
HolidaysListBox.SelectedValue

But I don't know how to get the multiselected ValueMember results from this
listbox, anyone can help me?

Thanks
 
B

Bernie Yaeger

Hi Tony,

Here's some code that should help:

Dim i As Integer

For i = 0 To selectbox.SelectedItems.Count - 1

messagebox.show(selectbox.selecteditems(i))

Next

HTH,

Bernie Yaeger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top