VB 消息框 yes/no 我希望 'no' 关闭消息框,但它关闭了我想打开的表单
VB messagebox yes/no I want the 'no' to close message box, but its closing the form i want open
Private Sub btnMain_Click(sender As Object, e As EventArgs) Handles btnMain.Click
Dim result As DialogResult = MessageBox.Show("Did you save customer info?", "Save Information", MessageBoxButtons.YesNo, MessageBoxIcon.Stop)
If (result = DialogResult.Yes) Then
'Me.Visible = False
Me.Close()
frmDuneTours.Visible = True
ElseIf (result = DialogResult.No) Then
frmDuneTours.Visible = False
Me.Visible = True
End If
End Sub
当你把Me.Close放在前面
frmDuneTours.Visible = 正确
第二行永远不会执行,因为当您关闭当前表单时,应用程序结束。
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim result As DialogResult = MessageBox.Show("Did you save customer info?", "Save Information", MessageBoxButtons.YesNo, MessageBoxIcon.Stop)
If (result = DialogResult.Yes) Then
frmSortedList.Visible = True
Me.Close()
ElseIf (result = DialogResult.No) Then
frmSortedList.Visible = False
End If
End Sub
Private Sub btnMain_Click(sender As Object, e As EventArgs) Handles btnMain.Click
Dim result As DialogResult = MessageBox.Show("Did you save customer info?", "Save Information", MessageBoxButtons.YesNo, MessageBoxIcon.Stop)
If (result = DialogResult.Yes) Then
'Me.Visible = False
Me.Close()
frmDuneTours.Visible = True
ElseIf (result = DialogResult.No) Then
frmDuneTours.Visible = False
Me.Visible = True
End If
End Sub
当你把Me.Close放在前面 frmDuneTours.Visible = 正确 第二行永远不会执行,因为当您关闭当前表单时,应用程序结束。
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim result As DialogResult = MessageBox.Show("Did you save customer info?", "Save Information", MessageBoxButtons.YesNo, MessageBoxIcon.Stop)
If (result = DialogResult.Yes) Then
frmSortedList.Visible = True
Me.Close()
ElseIf (result = DialogResult.No) Then
frmSortedList.Visible = False
End If
End Sub