我在vb 2010中有一个包含组合框和按钮的Windows窗体应用程序。要显示的下一个表单取决于用户选择的选项。如何在点击按钮时输入此代码?
答案 0 :(得分:1)
以下是一个如何做到这一点的例子:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim nextForm As Form = Nothing
Select Case ComboBox1.SelectedText
Case "Option 1"
nextForm = New Form2()
Case "Option 2"
nextForm = New Form3()
End Select
If nextForm IsNot Nothing Then
nextForm.Show()
End If
End Sub