B
BigRich
Binding control property used with DataGridTextBoxColumn
in datagrid
I'm having trouble with the WinFoms DataGrid control.
I'm using a collection of DataGridTextBoxColumn(s) and
DataGridBoolColumn(s) in a DataGridTableStyle on a
DataGrid.
I need to format and parse each column distinctly, so I'm
adding a Binding, and then Format and Parse event
handlers, to the DataGrid.
Although my code throws no exceptions, the Format event
doesn't seem to fire... I think the problem lies in what
to specify as the control property in the Binding
constructor call.
While I'm usually loathe to post code ("Read my code"
== "Eat my shorts"), here's a simplified fragment. I'd
appreciate a hand with this:
DataGridTableStyle columns = new DataGridTableStyle();
columns.MappingName = "myTable";
DataGridTextBoxColumn colTime = new DataGridTextBoxColumn
();
colTime.HeaderText = "Time";
colTime.MappingName = "time"; // valid DataTable col name
columns.GridColumnStyles.Add(this.colTime);
myGrid.TableStyles.Add(this.columns);
Binding timeBinding = new Binding(
colTime.TextBox.Text.ToString(),
myTable,
"time");
timeBinding.Format += new ConvertEventHandler
(timeBinding_Format);
myGrid.DataBindings.Add(timeBinding);
CheersThenYeah
BigRich
in datagrid
I'm having trouble with the WinFoms DataGrid control.
I'm using a collection of DataGridTextBoxColumn(s) and
DataGridBoolColumn(s) in a DataGridTableStyle on a
DataGrid.
I need to format and parse each column distinctly, so I'm
adding a Binding, and then Format and Parse event
handlers, to the DataGrid.
Although my code throws no exceptions, the Format event
doesn't seem to fire... I think the problem lies in what
to specify as the control property in the Binding
constructor call.
While I'm usually loathe to post code ("Read my code"
== "Eat my shorts"), here's a simplified fragment. I'd
appreciate a hand with this:
DataGridTableStyle columns = new DataGridTableStyle();
columns.MappingName = "myTable";
DataGridTextBoxColumn colTime = new DataGridTextBoxColumn
();
colTime.HeaderText = "Time";
colTime.MappingName = "time"; // valid DataTable col name
columns.GridColumnStyles.Add(this.colTime);
myGrid.TableStyles.Add(this.columns);
Binding timeBinding = new Binding(
colTime.TextBox.Text.ToString(),
myTable,
"time");
timeBinding.Format += new ConvertEventHandler
(timeBinding_Format);
myGrid.DataBindings.Add(timeBinding);
CheersThenYeah
BigRich