Combo Box Problem
Go to solution
Solved by madknight3,
I think what you want is to clear, or reset, the text of the unused boxes.
So in your first function where you selected an item you want to do
Model.Items.Clear()Model.Text = "" // or "Select Model"Series.Items.Clear()Series.Text = "" // or "Select Series"
Then when your model is selected, you just reset the series.
That way you always make sure the next combo box being selected is always reset.
You can also make that into a method. I've used an optional parameter so you can choose to provide the method with a string, like "Select Model". But if you don't want to, it'll just default to the empty string.
Public Sub ResetComboBox(ByVal box As ComboBox, Optional ByVal text As String = "") box.Items.Clear() box.Text = textEnd Sub
Then
// Instead ofMake.Text = "Select Make"Model.Items.Clear()Model.Text = "Select Model"Series.Items.Clear()Series.Text = "Select Series"// You can useResetComboBox(Make, "Select Make")ResetComboBox(Model, "Select Model")ResetComboBox(Series, "Select Series")// or if you want to clear the text instead of set itResetComboBox(Make)ResetComboBox(Model)ResetComboBox(Series)
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now