Click here to Skip to main content
16,017,650 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i have a DataGridView which i have manually coded into the form, and cells 4,5,7,8,9 are checkbox fields, and i need 3 answers for the checkboxes so that when the DGV is loaded it is 'null' and then the user inputs true or false. is there a way to do this? as if i put anything other than 'true' or 'false' i get an error, i have tried to put 'Indeterminate' but that still throws an error.

C#
TMSScoreSheet.Rows[0].Cells[4].Value = "Indeterminate";
TMSScoreSheet.Rows[0].Cells[5].Value = "False";
TMSScoreSheet.Rows[0].Cells[7].Value = "False";
TMSScoreSheet.Rows[0].Cells[8].Value = "False";
TMSScoreSheet.Rows[0].Cells[9].Value = "False";


Billy
Posted
Updated 27-Feb-12 5:50am
v2
Comments
Dean Oliver 27-Feb-12 11:02am    
a checkbox takes a boolean value which can only be true or false. I think rather change your approach.
BunkerBilly 27-Feb-12 11:13am    
but a normal checkbox can have 3 check states? are they not the same as the values?
Shahin Khorshidnia 27-Feb-12 11:44am    
Please tag your question. WinForm? WPF? ...?

Please!
Please!
Please!
BunkerBilly 27-Feb-12 11:48am    
its WinForm, i used the

<pre lang="c#"> bool? b = null</pre>

and set the checkbox to b and it worked great, thanks shahin
Shahin Khorshidnia 27-Feb-12 11:50am    
You're Welcome.

1 solution

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