Everyone:
Using C#, I'm trying to create a datagrid on a winform programatically .
I placed the datagrid and the form and named it CHGrid. Here's the
code I'm using:
// Get and bind the data.
QarBusTier.Defe ctFoundLocation DFL = new
QarBusTier.Defe ctFoundLocation ();
System.Data.Dat aTable DFLTable = DFL.LoadAll();
CHGrid.DataSour ce = DFLTable;
// Set the data grid style.
DataGridTableSt yle ts1 = new DataGridTableSt yle();
ts1.MappingName = "Customers" ;
// Set the datagrid style.
CHGrid.Top = 50;
CHGrid.Left = 200;
CHGrid.Width = 350;
CHGrid.Height= 200;
CHGrid.ForeColo r = System.Drawing. Color.Black;
CHGrid.BackColo r = System.Drawing. Color.Beige;
// Create column.
DataGridBoolCol umn myDataCol = new DataGridBoolCol umn();
myDataCol.Mappi ngName = "DefectFoundLoc ationId";
myDataCol.Heade rText = "My New Column";
myDataCol.Width = 100;
ts1.GridColumnS tyles.Add(myDat aCol);
CHGrid.TableSty les.Add(ts1);
The DFL.LoadAll() just gets all the data from a table. My grid is
populated with the 4 columns being returned from DFL.LoadAll() but the
column I create is not being displayed.
I want to display only the column(s) I create and not have the grid
auto-populate.
Thanks for the help,
Dale Williams
Using C#, I'm trying to create a datagrid on a winform programatically .
I placed the datagrid and the form and named it CHGrid. Here's the
code I'm using:
// Get and bind the data.
QarBusTier.Defe ctFoundLocation DFL = new
QarBusTier.Defe ctFoundLocation ();
System.Data.Dat aTable DFLTable = DFL.LoadAll();
CHGrid.DataSour ce = DFLTable;
// Set the data grid style.
DataGridTableSt yle ts1 = new DataGridTableSt yle();
ts1.MappingName = "Customers" ;
// Set the datagrid style.
CHGrid.Top = 50;
CHGrid.Left = 200;
CHGrid.Width = 350;
CHGrid.Height= 200;
CHGrid.ForeColo r = System.Drawing. Color.Black;
CHGrid.BackColo r = System.Drawing. Color.Beige;
// Create column.
DataGridBoolCol umn myDataCol = new DataGridBoolCol umn();
myDataCol.Mappi ngName = "DefectFoundLoc ationId";
myDataCol.Heade rText = "My New Column";
myDataCol.Width = 100;
ts1.GridColumnS tyles.Add(myDat aCol);
CHGrid.TableSty les.Add(ts1);
The DFL.LoadAll() just gets all the data from a table. My grid is
populated with the 4 columns being returned from DFL.LoadAll() but the
column I create is not being displayed.
I want to display only the column(s) I create and not have the grid
auto-populate.
Thanks for the help,
Dale Williams
Comment