Tuesday, March 15, 2011

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 for 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?

From stackoverflow
  • When you define the columns for the ListView, you have to change the type to checkbox

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

    Adam Haile : Awesome...that was exactly what I was looking for. Didn't even think to look for another control other than listbox. Thanks!

0 comments:

Post a Comment