Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Getting combobox selectedindex by selected item or selected text

I need help :confused: in the subject that how can i get the selected index of a selected text item of combo box .
all i want is that when the form loads it should display the "Favourites" item as default selected item so for but as the user has the option to list "FAvourites" text selected combo bx anywhere in items list so it should become default selected by
If cbofolders.SelectedText = "Favourites" Then
' cbofolders.SelectedIndex = here i want it to acquire the value of slected (i.e. "Favourite") text's selected index

End If
:cool:
this way i get whatever the selected index value is to cbofolders.selectedindex .Plz code me it in vb.net

Also plz refer me som book that provides complete information regarding methods & property of controls available default in VB.Net & how to use.

Thanx in Advance. :WAVE:
[903 byte] By [DEVILSAN] at [2007-11-11 7:40:48]
# 1 Re: Getting combobox selectedindex by selected item or selected text
If I understand you correctly, you want to select the "Favourites" item in cboFolders when the form loads, correct? If so, simply add the following to your Form_Load event:

cboFolders.Text = "Favourites"

If you need to know the index of the "Favourites" item, you may then use .SelectedIndex to obtain it.
Phil Weber at 2007-11-11 21:48:43 >