开发者

Checkbox In Listview + vb.net

Can anyone help me on how to do this..

I have a ListView with Checkboxes in vb.net and what I want to do is when the user check the checkbox, the开发者_如何转开发 program ignore the response of the user in checking the checkbox, instead it leaves the checkbox uncheck..

This concern is uses for may validation..

Thanks for your positive response regarding this..


Edit, removed untested solution.

Private Sub ListView1_ItemCheck(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles ListView1.ItemCheck
    e.NewValue = CheckState.Unchecked
End Sub


Dim lastUndo As Boolean = False
Private Sub thisListView_ItemChecked(sender As System.Object, e As System.Windows.Forms.ItemCheckedEventArgs) Handles thisListView.ItemChecked
    If lastUndo Then
        lastUndo = False
    Else
        If thisListView.Focused Then
            lastUndo = True
            e.Item.Checked = Not e.Item.Checked
        End If
    End If
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜