DataGird Can U help Me
-
I want set CheckBox is Items of DataGird In WinForm Checkbox Items In A DataGrid WinForms C#
You bind a datagrid to a data source to display contents on the grid. Usually a dataset gets bound to the grid. In this case, if one of the columns in the dataset is a boolean value, checkbox automatically appears for that boolean column in the datagrid. Ciao There has to be more to life than just this -- modified at 23:15 Thursday 23rd February, 2006
-
You bind a datagrid to a data source to display contents on the grid. Usually a dataset gets bound to the grid. In this case, if one of the columns in the dataset is a boolean value, checkbox automatically appears for that boolean column in the datagrid. Ciao There has to be more to life than just this -- modified at 23:15 Thursday 23rd February, 2006
-
try this. Note that dataGrid1 must be a DataGrid control that you dragged and dropped onto your form. using System.Data; ... private void MainForm_Load(object sender, System.EventArgs e) { DataSet ds = new DataSet(); ds.Tables.Add ("One"); ds.Tables[0].Columns.Add ("A"); ds.Tables[0].Columns.Add ("B"); ds.Tables[0].Columns[0].DataType = typeof (bool); ds.Tables[0].Columns[1].DataType = typeof (string); ds.Tables[0].Rows.Add (new object[] {true, "First"}); dataGrid1.DataSource = ds; } ... Hope this helps. There has to be more to life than just this
-
try this. Note that dataGrid1 must be a DataGrid control that you dragged and dropped onto your form. using System.Data; ... private void MainForm_Load(object sender, System.EventArgs e) { DataSet ds = new DataSet(); ds.Tables.Add ("One"); ds.Tables[0].Columns.Add ("A"); ds.Tables[0].Columns.Add ("B"); ds.Tables[0].Columns[0].DataType = typeof (bool); ds.Tables[0].Columns[1].DataType = typeof (string); ds.Tables[0].Rows.Add (new object[] {true, "First"}); dataGrid1.DataSource = ds; } ... Hope this helps. There has to be more to life than just this
Thanks But I use DataGridTableStyle fill Data (Dataset->DataGird) Ex: DataGridTextBoxColumn dgColumn; DataGridTableStyle dgTablestyle=null; public void dgAddColum() { try { dgTablestyle.GridColumnStyles.Clear(); RemoveControlBindings(); AddDataControlBindings(); this.dgAssinStyle("dg_id","dg_id",dgTablestyle); this.dgAssinStyle("dg_name","dg_name",dgTablestyle); this.dgAssinStyle("dg_text","dg_text",dgTablestyle); this.dgAssinStyle("dg_info","dg_info",dgTablestyle); } catch(Exception ex) { MessageBox.Show(ex.Message); } } //Gan HeaderText, MappingName vao public void dgAssinStyle(string headerText, string mappingName, DataGridTableStyle tablestyle) { dgColumn = new DataGridTextBoxColumn(); dgColumn.HeaderText = headerText; dgColumn.MappingName = mappingName; tablestyle.GridColumnStyles.Add(dgColumn); } After Add Collum CheckBox to DataGird if U have a Ex for Me veryGood thanks:doh:
-
Thanks But I use DataGridTableStyle fill Data (Dataset->DataGird) Ex: DataGridTextBoxColumn dgColumn; DataGridTableStyle dgTablestyle=null; public void dgAddColum() { try { dgTablestyle.GridColumnStyles.Clear(); RemoveControlBindings(); AddDataControlBindings(); this.dgAssinStyle("dg_id","dg_id",dgTablestyle); this.dgAssinStyle("dg_name","dg_name",dgTablestyle); this.dgAssinStyle("dg_text","dg_text",dgTablestyle); this.dgAssinStyle("dg_info","dg_info",dgTablestyle); } catch(Exception ex) { MessageBox.Show(ex.Message); } } //Gan HeaderText, MappingName vao public void dgAssinStyle(string headerText, string mappingName, DataGridTableStyle tablestyle) { dgColumn = new DataGridTextBoxColumn(); dgColumn.HeaderText = headerText; dgColumn.MappingName = mappingName; tablestyle.GridColumnStyles.Add(dgColumn); } After Add Collum CheckBox to DataGird if U have a Ex for Me veryGood thanks:doh:
Hello, Use DataGridBoolColumn for boolean columns by checking their DataType property HTH. Cheers. Maqsood Ahmed - MCAD.net Kolachi Advanced Technologies http://www.kolachi.net