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

JD2369

Member
Joined
Jan 12, 2011
Messages
19
Programming Experience
Beginner
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
 
Give it a try.... did not proof it in visual studio so check for errors. :)

VB.NET:
Public Sub OpenForm_Click(ByVal sender As Object, ByVal e As EventArgs) Handles openforms.Click

     Dim formToOpen As Form = Nothing
     If selectedForm.SelectedIndex = 0 Then 
          formToOpen = new Form3()
     Else
          formToOpen = new Form4()
     End If

     If formToOpen IsNot Nothing Then
         formToOpen.Show()    
     End If
End Sub
 
Back
Top