How do I reset a combobox to a specific item in the items collection?
Posted on 2005-05-06
I have a form that is used to gather search criteria. One of the controls is a button to clear all the fields to start a new search, another control is a combo box that is populated from the items collection of "NO", "YES", "MAYBE", "DON'T KNOW". Because 95% of the time the answer is "NO", the user wants that to be the default value and it will only be changed rarely. Here is what I have so far:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ComboBox.Text = "No"
Public Sub ClearScreen(ByVal FormName As Form)
Dim ctl As Control
For Each ctl In FormName.Controls()
If ctl.Tag Like "Init*" Then
This works great on form1_load. My problem is when the user clicks the "Clear" button and I execute the same code I do on form1_load, the combobox is now empty. How do I get it to display the "NO" again?