Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set a VB.Net ComboBox default value

Tags:

vb.net

I can not locate the correct method to make the first item in a combo box visible.

The app starts with an empty combo box. The user makes a radio box selection then clicks Go! (how original). The combo box is loaded via an LDAP query. All this is working just fine. The problem is the combo box still appears to the user to be empty. They must click the arrow to see the options.

How do I make the first option 'visible' after the users clicks Go!?

like image 278
Mr Ed Avatar asked Apr 14 '10 13:04

Mr Ed


People also ask

How do I code a ComboBox in Visual Basic?

To add items to a ComboBox, select the ComboBox control and go to the properties window for the properties of this control. Click the ellipses (...) button next to the Items property. This opens the String Collection Editor dialog box, where you can enter the values one at a line.

What is combo box control in VB net?

The ComboBox control is used to display more than one item in a drop-down list. It is a combination of Listbox and Textbox in which the user can input only one item. Furthermore, it also allows a user to select an item from a drop-down list.

What is a ComboBox control?

A combo box is a text box with a list box attached. This type of control enables users to select a predefined value in a list or type their own value in the text box portion of the control. The list is hidden until the user clicks the arrow next to the box.

How do I clear a ComboBox in Visual Studio?

To clear what the user types in the combobox combobox. Text = String. Empty will work because the combobox also has a text property. Use both of these to ensure it will clear the fields.


1 Answers

 ' Your code filling the combobox '
 ...

 If myComboBox.Items.Count > 0 Then
     myComboBox.SelectedIndex = 0    ' The first item has index 0 '
 End If
like image 94
Heinzi Avatar answered Sep 22 '22 22:09

Heinzi