How to disable the checkbox in the listview

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

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

Thanks advance
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top