好日子所有,我是有一些麻煩我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