Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Place a CheckBox in a ListViewSubItem

I'm trying to create a WinForms ListView control with 6 columns. The first two columns will have text in them, but I want the last four columns to have a checkbox in them.

I know how to add a ListViewSubItem with text (did this for the second column), but how do you insert a CheckBox?

like image 687
Adam Haile Avatar asked Oct 27 '22 06:10

Adam Haile


1 Answers

ListView doesn't support this. Only the 1st column can have a checkbox. You could fake it with custom drawing and mouse hit testing but that's a lot of work. Consider using a DataGridView instead. You can change the column type to DataGridViewCheckBoxColumn.

like image 139
Hans Passant Avatar answered Nov 15 '22 07:11

Hans Passant