views:

627

answers:

1

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..

A: 

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
ho1
I already try it, but I doesn't work.. I also try in selectedIndexChange event but still not working..
Mark
I missed that there was both a Checked and a Check event, I think my previous idea might have worked if it had been in the Checked event instead, but either way, my edited solution is much neater.
ho1
Ill also try that but that code was never allow the user to check another rows.. I already have a nested statement but still not working.. Did you have an any idea?
Mark
Well, the answer above does work as far as I understand the question. If rather than just keeping them all unchecked you want to keep them in whatever value they currently are, e.NewValue = e.CurrentValue might work. And if you only want to disable certain rows you should be able to use e.Index I'd have thought.
ho1