代码之家  ›  专栏  ›  技术社区  ›  newb7777

如何将消息框结果设置为转到在VB中创建的选项卡页面。网

  •  1
  • newb7777  · 技术社区  · 7 年前

    我想让用户输入一些信息,以确定我的程序中的下一步。代码如下所示。

    If MessageBox.Show("Do you want to Program More Devices?", "             MORE DEVICES TO PROGRAM", _
          MessageBoxButtons.YesNo, MessageBoxIcon.Question) _
          = DialogResult.No Then
                Application.Exit()
            Else
                <If answer is Yes then I would like to go to Tabpage1>
    
            End If
    

    tabpage1 哪里 Me.TabPage1 = New System.Windows.Forms.TabPage

    1 回复  |  直到 7 年前
        1
  •  1
  •   BanForFun    7 年前

    Dim dResult As DialogResult = MessageBox.Show("Do you want to go to tabpage1?", "Title", MessageBoxButtons.YesNo)
    If dResult = DialogResult.Yes Then
       TabControlName.SelectedTab = TabPage1
    ElseIf dResult = DialogResult.No Then
                'do nothing?
    End If