Home All Groups Group Topic Archive Search About

How to disable the checkbox in the listview

Author
7 Mar 2006 7:45 AM
Li Pang
Hi,

I use checkbox in the listview, sometime, I want to disable these
checkboxes, any body knows how to do so?

Thanks advance

Author
8 Mar 2006 3:51 PM
Claes Bergefall
Handle the ItemChecked or ItemCheck event and set the NewValue back to the
CurrentValue in the supplied event args, i.e.:

Private Sub ListView1_ItemCheck(ByVal sender As Object, ByVal e As
System.Windows.Forms.ItemCheckEventArgs) Handles ListView1.ItemCheck
    If e.Index = 0 Then
        e.NewValue = e.CurrentValue
    End If
End Sub

This will effectively prevent the user from changing the value


   /claes


Show quoteHide quote
"Li Pang" <LiP***@discussions.microsoft.com> wrote in message
news:F54DC855-136C-4115-96D3-8DE0E8CBC510@microsoft.com...
> Hi,
>
> I use checkbox in the listview, sometime, I want to disable these
> checkboxes, any body knows how to do so?
>
> Thanks advance