G
Guest
I have a TabControl that is on a form that is bound to a DataSet. I bind the
dataset to the form in the Form_Load event. The TabControl has 2 TabPages.
The first TabPage contains a button and a textbox.
Scenario 1:
I call BindingContext(ds.TableName).AddNew(), then I click the button and
that populates some text into the textbox on the first tab. Then I switch
over to Tab2 and back to Tab1. The text that was programatically inserted is
now gone.
Scenario 2:
I do NOT call BindingContext(ds.TableName).AddNew(), then I click the button
and that populates some text into the textbox on the first tab. Then I
switch over to Tab2 and back to Tab1. The text that was programatically
inserted is still there.
I want the form to work like it does in Scenario 2, but without calling
AddNew() my DataSet will not show HasChanges.
Aside from calling BindingContext(ds.tablename).EndCurrentEdit() after
clicking on the button to populate the textbox, is there any way to keep this
data on the form?
PS - I understand that the TabControl does not bind its data to the controls
until each TabPage is shown. Could it be that the TabControl is trying to
re-bind the data on TabPage1 when I come back to it and therefore it shows no
data?
dataset to the form in the Form_Load event. The TabControl has 2 TabPages.
The first TabPage contains a button and a textbox.
Scenario 1:
I call BindingContext(ds.TableName).AddNew(), then I click the button and
that populates some text into the textbox on the first tab. Then I switch
over to Tab2 and back to Tab1. The text that was programatically inserted is
now gone.
Scenario 2:
I do NOT call BindingContext(ds.TableName).AddNew(), then I click the button
and that populates some text into the textbox on the first tab. Then I
switch over to Tab2 and back to Tab1. The text that was programatically
inserted is still there.
I want the form to work like it does in Scenario 2, but without calling
AddNew() my DataSet will not show HasChanges.
Aside from calling BindingContext(ds.tablename).EndCurrentEdit() after
clicking on the button to populate the textbox, is there any way to keep this
data on the form?
PS - I understand that the TabControl does not bind its data to the controls
until each TabPage is shown. Could it be that the TabControl is trying to
re-bind the data on TabPage1 when I come back to it and therefore it shows no
data?