B
Bob Libby
I'm trying to skip the ItemDescription column when the user tabs off the
ItemNumber column in the following code. The DataGridTextBoxColumn.TabStop
property doesn't seem to have any effect. The code uses a DataGrid called
dataGrid1.
Any help would be appreciated.
Thanks,
public Form1()
{
InitializeComponent();
DataTable table = new DataTable("OrderDetail");
table.Columns.Add("ItemNumber", typeof(string));
table.Columns.Add("ItemDescription", typeof(string));
table.Columns.Add("Price", typeof(decimal));
DataRow dataRow = table.NewRow();
dataRow["ItemNumber"] = "ITEM1";
dataRow["ItemDescription"] = "ITEM1 DESC";
dataRow["Price"] = 5.0;
table.Rows.Add(dataRow);
dataRow = table.NewRow();
dataRow["ItemNumber"] = "ITEM2";
dataRow["ItemDescription"] = "ITEM2 DESC";
dataRow["Price"] = 6.0;
table.Rows.Add(dataRow);
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = "OrderDetail";
DataSet ds = new DataSet("OrderDetail");
DataGridTextBoxColumn column = new DataGridTextBoxColumn();
column.HeaderText = "Item Number";
column.MappingName = "ItemNumber";
tableStyle.GridColumnStyles.Add(column);
column = new DataGridTextBoxColumn();
column.HeaderText = "Description";
column.MappingName = "ItemDescription";
column.ReadOnly = true;
column.TextBox.TabStop = false;
tableStyle.GridColumnStyles.Add(column);
column = new DataGridTextBoxColumn();
column.HeaderText = "Price";
column.MappingName = "Price";
column.Format = "c";
column.Alignment = HorizontalAlignment.Right;
tableStyle.GridColumnStyles.Add(column);
dataGrid1.TableStyles.Add(tableStyle);
ds.Tables.Add(table);
dataGrid1.SetDataBinding(ds, table.TableName);
}
ItemNumber column in the following code. The DataGridTextBoxColumn.TabStop
property doesn't seem to have any effect. The code uses a DataGrid called
dataGrid1.
Any help would be appreciated.
Thanks,
public Form1()
{
InitializeComponent();
DataTable table = new DataTable("OrderDetail");
table.Columns.Add("ItemNumber", typeof(string));
table.Columns.Add("ItemDescription", typeof(string));
table.Columns.Add("Price", typeof(decimal));
DataRow dataRow = table.NewRow();
dataRow["ItemNumber"] = "ITEM1";
dataRow["ItemDescription"] = "ITEM1 DESC";
dataRow["Price"] = 5.0;
table.Rows.Add(dataRow);
dataRow = table.NewRow();
dataRow["ItemNumber"] = "ITEM2";
dataRow["ItemDescription"] = "ITEM2 DESC";
dataRow["Price"] = 6.0;
table.Rows.Add(dataRow);
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = "OrderDetail";
DataSet ds = new DataSet("OrderDetail");
DataGridTextBoxColumn column = new DataGridTextBoxColumn();
column.HeaderText = "Item Number";
column.MappingName = "ItemNumber";
tableStyle.GridColumnStyles.Add(column);
column = new DataGridTextBoxColumn();
column.HeaderText = "Description";
column.MappingName = "ItemDescription";
column.ReadOnly = true;
column.TextBox.TabStop = false;
tableStyle.GridColumnStyles.Add(column);
column = new DataGridTextBoxColumn();
column.HeaderText = "Price";
column.MappingName = "Price";
column.Format = "c";
column.Alignment = HorizontalAlignment.Right;
tableStyle.GridColumnStyles.Add(column);
dataGrid1.TableStyles.Add(tableStyle);
ds.Tables.Add(table);
dataGrid1.SetDataBinding(ds, table.TableName);
}