C# DataSet CheckBox Column With DevExpress DataGrid
- by Goober
Scenario
I have a DevExpress DataGrid which is bound to a DataSet in C#.
I want to populate each dataset row to contain a string in the first column and a checkbox in the second. My code below doesn't work quite how I want it to, and I'm not sure why.....
The Code
As you can see I've declared a dataset, but when I try and pass in a new checkbox object to the 2nd column it just displays the system name for the checkbox.
DataSet prodTypeDS = new Dataset();
DataTable prodTypeDT = prodTypeDS.Tables.Add();
prodTypeDT.Columns.Add("MurexID", typeof(string));
prodTypeDT.Columns.Add("Haganise",typeof(CheckBox));
//WHY DOES THIS NOT WORK?
//(Displays "System.Windows.Forms.CheckBox, CheckState: 0")
//Instead of a checkbox.
CheckBox c = new CheckBox();
prodTypeDS.Tables[0].Rows.Add("Test",c);
//This doesn't work either....
prodTypeDS.Tables[0].Rows.Add("Test",c.CheckState);
......I hope this is just because it's a DevExpress datagrid....