P
perrycheung221
Hi all,
I got a problem of getting a display text and value from a item of a
listbox
Below is how I databind the data into myListBox
dt is a dataTable with 2 column, ID (int) and value (string)
Me.myListBox.DisplayMember = dt.Columns(1).ColumnName
Me.myListBox.ValueMember = dt.Columns(0).ColumnName
Me.myListBox.DataSource = dt
Now, I want to get the value out from myListBox:
For i As Integer = 0 To myListBox.Items.Count - 1
Dim li As ListItem
li.ItemData = lbChosenWork.Items.Item(i).Value <- I
want sth like this
li.Name = lbChosenWork.Items.Item(i).Text <- I want
sth like this
Next
However, methods .value and .text are not avaliable for me to use....
Anyone know the way to get the Display text of the item in myListBox?
Many thanks
I got a problem of getting a display text and value from a item of a
listbox
Below is how I databind the data into myListBox
dt is a dataTable with 2 column, ID (int) and value (string)
Me.myListBox.DisplayMember = dt.Columns(1).ColumnName
Me.myListBox.ValueMember = dt.Columns(0).ColumnName
Me.myListBox.DataSource = dt
Now, I want to get the value out from myListBox:
For i As Integer = 0 To myListBox.Items.Count - 1
Dim li As ListItem
li.ItemData = lbChosenWork.Items.Item(i).Value <- I
want sth like this
li.Name = lbChosenWork.Items.Item(i).Text <- I want
sth like this
Next
However, methods .value and .text are not avaliable for me to use....
Anyone know the way to get the Display text of the item in myListBox?
Many thanks