VB.NET: Where is ListIndex property?

andy7789
andy7789 used Ask the Experts™
on
Hi x-perts,

I am migrating from VBA to VB.NET

where is listindex property for listboxes and comboboxes?

I have been comparing ListIndex with -1 to find, if nothing is selected, i.e.

myForm.ComboBox1.ListIndex = -1

how can I do it in VB.NET?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Use Combobox1.SelectedIndex
Kamaraj SubramanianApplication Support Analyst
Commented:
check all the properties here

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox_properties.aspx
Dim instance As ListControl
Dim value As Object
value = instance.SelectedValue
instance.SelectedValue = value

Open in new window

Kamaraj SubramanianApplication Support Analyst

Commented:
As mentioned by Jeop,

you can use SelectedIndex  property

Author

Commented:
Thank you,

So, if nothing is selected, Combobox1.SelectedIndex = -1

correct?
Yes

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial