Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there. I need to display text with a checkbox in a checkbox column in a datagridview in a windows forms application.
Posted

Hello,
if you want quick solution,for small amount of cell,
you could do this :

1. Make one column with ColumnType DataGridViewCheckBoxColumn ,
cells in that column shell be check boxes.Also make it small as the check box.
Header text for this column shall be empty string (nothing).

2. Make second column with ColumnType dataGridViewTextBoxColumn where all the
cells shall be text boxes. Header text of that column shall be the text you
want for the first column.

3. Using DataGridView(column,row).Value = "text"; you
can set the initial value , text, in every single cell in that column ,
except in case if you are creating too complex program, with many cells.

4. Using different DataGridViewCellStyles from properties panel , you can make
that it looks like it is one cell with check box and text.Perhaps it looks
even better.

Other solution is to reprogram current DataGridViewCheckBoxColumn class and make your own with that possibility to have check box and text in the same cell.
For me it is too complicated and with unknown results.

All well,
Peric Zeljko
<removed>@yahoo.com
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900