ComboBox task

MattyMS

New member
Joined
May 20, 2012
Messages
3
Programming Experience
1-3
Hi i am not sure if this is the right place to post this. I am trying to make it so when i choose a item in the combo box the list box is cleared i have tried these two codes and i cannot thing of any others but it does not work can someone help me?

VB.NET:
Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged

ListBox2.ResetText
    End Sub
and

VB.NET:
 Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

ListBox2.ResetText
     End Sub
 
ListBox2.Items.Clear()
 
Remember to consider the person may want to select the default option in the combo box, in which case the selected index wont change. Either the first option could be blank so the user has to change the selection, or you could have a button handling the selection. First option there is a lot cleaner I think.
 
Back
Top