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

Member Avatar for Unhnd_Exception

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

thanks your the best

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.