The combo box will show the category.
Suppose there are 2 categories A and B.
When we click on A then the code given inside 4 buttons should work.
I tried in this way ,I checked the condition of selecteditem based on that added all 4buttons sub code.
But it shows blue underlines.
I did in this way:
If ComboBox1.SelectedItem = "A" Then
Private Sub Button1_Click....
//code is here
End sub

Like this I have used 3 more buttons.

How can it be done?

You could create a boolean check.

Example:

Dim canExecute As Boolean = False



'From the ComboBox's indexChanged event, do the following:'

 If ComboBox1.SelectedValue = "A" Then
    canExecute = True
 End If



'From the Button's click event, do the following:'
If canExecute = True Then
    'My Code Here'
End If

Is this what you are looking for?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.