CheckedChanged
值: True / False
CheckedStateChanged
值: CheckState.Indeterminate(會打勾 並且會有灰色網格背景)
/ CheckState.Unchecked / CheckState.Checked
事件觸發:
從控制項改變值 或 從程式改變值
兩者事件都會觸發
'做驗證時,千萬別用 CheckedChanged 與 CheckedStateChanged 會進入無窮迴圈XD
Private Sub CheckBox2_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CheckBox2.Validating
'實現VBA Method [Me.Undo()功能] (解釋--還原到先前的值!!)
If Me.CheckBox2.CheckState = CheckState.Checked Then
Me.CheckBox2.CheckState = CheckState.Unchecked
Else
Me.CheckBox2.CheckState = CheckState.Checked
End If
End Sub
NOTE:
如同 TextBox2.undo
參考:
CheckBox.CheckedChanged 事件
CheckBox.CheckStateChanged 事件
checkedBox 属性checkedChanged与checkedStateChanged 区别
VB2010之十二: CheckBox控件
沒有留言:
張貼留言