listbox index

  • Thread starter Thread starter Jeff Ciaccio
  • Start date Start date
J

Jeff Ciaccio

Man the help in VB.NET is hard to use!!

Can somebody please tell me the syntax to find the index value a user has
chosen from a list of items in a listbox. Also, is there a way to use the
string value instead of the index number?

I'm trying to do something like...

if lstBox.items.index = 0 then
stuff...
end if

OR

if lstBox.items.index = "California" then
stuff...
end if
 
Man the help in VB.NET is hard to use!!

Can somebody please tell me the syntax to find the index value a user has
chosen from a list of items in a listbox. Also, is there a way to use the
string value instead of the index number?

I'm trying to do something like...

if lstBox.items.index = 0 then
stuff...
end if

OR

if lstBox.items.index = "California" then
stuff...
end if

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog:http://sprayberry.typepad.com/ciaccio

As i understood, you need to get "selected" index and item:

For index value you need "lstBox.SelectedItems" :

' -----------------------------------

f lstBox.SelectedIndex = 0 then
' stuff...
end if

' ---------------------------------


To get Selected Item you need "lstBox.SelectedItem" :

' --------------------------------

if lstBox.SelectedItem = "California" then
stuff...
end if

' -----------------------

Thanks,

Onur Güzel
 
As i understood, you need to get "selected" index and item:

For index value you need "lstBox.SelectedItems" :

' -----------------------------------

f lstBox.SelectedIndex = 0 then
' stuff...
end if

' ---------------------------------

To get Selected Item you need "lstBox.SelectedItem" :

' --------------------------------

if lstBox.SelectedItem = "California" then
stuff...
end if

' -----------------------

Thanks,

Onur Güzel

Sorry correcting first line of my post:

For index value you need "lstBox.SelectedIndex" :

' -----------------------------------

f lstBox.SelectedIndex = 0 then
' stuff...
end if

' ........

Thanks,

Onur Güzel
 
Back
Top