hi all,
I created the datatable, and bound it to a datagrid and several textboxes. In my windows form I have a tabControl with two tabs:
- one for the list, with a datagrid that displays the content of the datatable,
- another tab called "detail" that displays the record selected on the datagrid. Here the user can modify a text box. And I would like to save the modification in the datatable. Otherwise when the user switches between the tabs "List" and "Details", the modifications entered in the text box are not visible in the datagrid.
Probably I am missing the "Me.BindingContext()"
I do not know how this BindingContext works.
As a short example lets say that I have the following datatable:
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Rows.Add("foo");
dt.Rows.Add("dsnv");
dt.Rows.Add("nv");
dt.Rows.Add(new object[] { null });
dt.Rows.Add(DBNull.Value);
Binding b = new Binding("Text", dt, "Name", true);
b.NullValue = "nv";
this.textBox1.DataBindings.Add(b);
Because the textbox in binded to the datatable, if I modify the value ot the textbox1. What do I have to to to save the new value on the datatable.
thanks
jsn
I created the datatable, and bound it to a datagrid and several textboxes. In my windows form I have a tabControl with two tabs:
- one for the list, with a datagrid that displays the content of the datatable,
- another tab called "detail" that displays the record selected on the datagrid. Here the user can modify a text box. And I would like to save the modification in the datatable. Otherwise when the user switches between the tabs "List" and "Details", the modifications entered in the text box are not visible in the datagrid.
Probably I am missing the "Me.BindingContext()"
I do not know how this BindingContext works.
As a short example lets say that I have the following datatable:
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Rows.Add("foo");
dt.Rows.Add("dsnv");
dt.Rows.Add("nv");
dt.Rows.Add(new object[] { null });
dt.Rows.Add(DBNull.Value);
Binding b = new Binding("Text", dt, "Name", true);
b.NullValue = "nv";
this.textBox1.DataBindings.Add(b);
Because the textbox in binded to the datatable, if I modify the value ot the textbox1. What do I have to to to save the new value on the datatable.
thanks
jsn