Datagrid checkbox states

S

Soulless

Hi, I am very new to C# and am trying to figure out DataGrids. I have
a DataGrid whos data member (I think that is what it is called) has a
checkbox on it. The checkbox defaults to a check that is greyed. We
want 2 states, not 3, on or off. Is this possible to do and if so,
how?

Thanks!
 
N

Nicholas Paldino [.NET/C# MVP]

Soulless,

You would want to get the DataGridViewCheckBoxColumn for that column and
set the ThreeState property to false.
 
S

Soulless

Soulless,

You would want to get the DataGridViewCheckBoxColumn for that column and
set the ThreeState property to false.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Hi, I am very new to C# and am trying to figure out DataGrids. I have
a DataGrid whos data member (I think that is what it is called) has a
checkbox on it. The checkbox defaults to a check that is greyed. We
want 2 states, not 3, on or off. Is this possible to do and if so,
how?
Thanks!- Hide quoted text -

- Show quoted text -

I apologize for my ignorance, but where should I set this? I am
trying to find the proper method/syntax to do this.
I type this.<name of DataGrid>. but am not sure what to pick from
the list. There is not a DataGridViewCheckBoxColumn.... do I need to
specify something more?

Sorry for my ignorance, I am trying to learn as quickly as possible.
Thanks very much for your help :)
 
N

Nicholas Paldino [.NET/C# MVP]

You can access the Columns collection, which is indexed by position, or
the name of the column. From there, you have to cast the return value to a
DataGridViewCheckBoxColumn, and then set the property:

// The column.
DataGridViewColumn column = this.gridView1.Columns["booleanColumn"];

// Cast to a DataGridViewCheckBoxColumn.
DataGridViewCheckBoxColumn checkboxColumn = (DataGridViewCheckBoxColumn)
column;

// Set the ThreeState property to false:
checkboxColumn.ThreeState = false;


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Soulless said:
Soulless,

You would want to get the DataGridViewCheckBoxColumn for that column
and
set the ThreeState property to false.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Hi, I am very new to C# and am trying to figure out DataGrids. I have
a DataGrid whos data member (I think that is what it is called) has a
checkbox on it. The checkbox defaults to a check that is greyed. We
want 2 states, not 3, on or off. Is this possible to do and if so,
how?
Thanks!- Hide quoted text -

- Show quoted text -

I apologize for my ignorance, but where should I set this? I am
trying to find the proper method/syntax to do this.
I type this.<name of DataGrid>. but am not sure what to pick from
the list. There is not a DataGridViewCheckBoxColumn.... do I need to
specify something more?

Sorry for my ignorance, I am trying to learn as quickly as possible.
Thanks very much for your help :)
 

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

Similar Threads

datagrid 3
DataGrid Boolean Column 4
DataGrid and DataSet 1
datagrid and checkbox 1
datagrid and checkbox and confirm dialog 4
datagridview and checkbox column 2
CheckBox in a DataGrid 3
Disable DataGrid 1

Top