Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value Based on Item not SelectedValue

Status
Not open for further replies.

RobS23

Programmer
Jun 4, 2001
161
GB
How do I pull out a value for the required - NOT selected Item in a listbox - I'm actually trying to pull out all the unchechecked Items and use their ValueMember values.

There has to be a nicer method than this:

MyListbox.SetSelected(indexValue, True)
Debug.WriteLine(MyListbox.SelectedValue)

It's late and my eyes are too tired to trawl through any more MSDN Library pages....all help appreciated.
 
Dim i As Integer
Dim DRV As DataRowView

For i = 0 To chklstUnAssigned.Items.Count - 1
DRV = chklstUnAssigned.Items.Item(i)
If chklstUnAssigned.GetItemChecked(i) = False Then
'This will show ValueMember for unchecked item.
MessageBox.Show(DRV.Item(0))
End If
Next

 
Ah another case of forget all we learnt from VB!
It was the dataviewrow bit that i needed.

DRV = chklstUnAssigned.Items.Item(i)
(DRV.Item(0))

Thanks Mate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top