Click here to Skip to main content
15,898,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i use list box control and i already set the selection property of ListBox multiple
but now i want to access value of listbox when selected index change using for loop.
Plz, anybody help me
Posted
Comments
SteveAdey 14-Feb-12 9:18am    
Think you're going to have to be more specific here. Please post some code.

1 solution

Sample VB .NET code is:

VB
set
        ListBox1.DataSource = dt
        ListBox1.DataTextField = "COMPANY_NAME"
        ListBox1.DataValueField = "CUSTID"

val=ListBox1.SelectedItem.Value

For i = 0 To ListBox1.Items.Count - 1
    If ListBox1.Items(i).Selected = True Then
        val= ListBox1.Items(i).Value
    End If
Next
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900