Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to set the first item in a combo box to the default option. Can anyone help me with that? I am using VB.Net 2008.
Posted
Updated 25-Jul-13 16:24pm
v2

VB
Combo1.ListIndex = 0




VB
Private Sub Form_Activate()
Dim a As Integer
For a = 1 To 30 Step 1
Combo1.AddItem a
Next
Combo1.ListIndex = 0
End Sub
 
Share this answer
 
v2
Set the selected index to 0
Ex:

VB
With Me.Combobox1
          .Items.Insert(0, "ID")
          .Items.Insert(1, "NAME")
          .Items.Insert(2, "DESCRIPTION")
          .SelectedIndex = 0
End With
 
Share this answer
 
v3

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