好日子所有,我是有一些麻烦我MSGBOX与vbyesnocancelMSGBOX和vbyesnocancel
提示•此代码一切工作就好了“但”我需要点击多次是,否,取消激活其功能
Private Sub cbEnableDeductions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbEnableDeductions.Click
If MsgBox("Do You want To Enable deductions?", vbYesNoCancel) = MsgBoxResult.Yes Then
cbEnableDeductions.Checked = True
txtSSS.Enabled = True
txtHDMF.Enabled = True
txtPhilHealth.Enabled = True
ElseIf MsgBox("Do You want To Enable deductions?", vbYesNoCancel) = MsgBoxResult.No Then
cbEnableDeductions.Checked = True
Total()
ElseIf MsgBox("Do You want To Enable deductions?", vbYesNoCancel) = MsgBoxResult.Cancel Then
cbEnableDeductions.CheckState = False
End If
End Sub
•使用此代码“否”和“取消”功能不工作
Private Sub cbEnableDeductions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbEnableDeductions.Click
If MsgBox("Do You want To Enable deductions?", vbYesNoCancel) = MsgBoxResult.Yes Then
cbEnableDeductions.Checked = True
txtSSS.Enabled = True
txtHDMF.Enabled = True
txtPhilHealth.Enabled = True
ElseIf vbYesNoCancel = MsgBoxResult.No Then
cbEnableDeductions.Checked = True
Total()
ElseIf vbYesNoCancel = MsgBoxResult.Cancel Then
cbEnableDeductions.CheckState = False
End If
End Sub
你真的应该使用MessageBox.Show(),而不是传统的msgbox()函数。我已经看到MsgBox的微妙的错误,其中对话框不会正确地出现在应用程序的前面。 – 2014-09-25 03:14:45