0

Linking Comb Box Items to a Button to load a new form

Combo box 3 has 2 items.....Item 1, Item 2

i want it so if you click on the button when item 1 is selected it will load form3 and if item 2 is selected the same button will load form 4

Thanks for your help

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by JD69
0

This should do that.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    If ComboBox3.SelectedIndex = -1 Then Exit Sub

    Select Case ComboBox3.SelectedIndex
        Case 0
            'show form 2
            My.Forms.Form2.Show()
        Case 1
           'show form 4
             
    End Select
End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.