ROGERDODGE
IS-IT--Management
Hi
I'm fairly new to C# and .NET coming from Visual FoxPro.
I have a Windows Form with TextBoxes which have been data-bound to a DataSet. Everything works fine as I scroll up and down the dataset.
I am struggling with a few issues (primarily of understanding since I am self-taught)
1) How can I detect if any of the textboxes have been edited so that I may set a flag to prompt the user along the lines of "Changes have been made - do you wish to save them" I am really try to adding an event to each text box. I have played about with OnRowChanging etc within the DataSet but have completely drawn a blank.
2) When I do make changes to the field, I am having trouble reflecting these changes back to the underlying database by using the daAdapter.Update(ds,"table") function. It simply does not work? I have got it all working by defining my own UpdateCmd and executing a cmdUpdate.ExecuteNonQuery() command. Before I do so, I have to explicitly code every textbox.Text value to my Update Command parameters. This is a b@ll-ache particularly with data records of 100+ fields.
Surely the idea of binding datasets to textBoxes is to have a two-way reflection of data? Did I miss something.
Any pointing in right directions would be most appreciated
Roger
I'm fairly new to C# and .NET coming from Visual FoxPro.
I have a Windows Form with TextBoxes which have been data-bound to a DataSet. Everything works fine as I scroll up and down the dataset.
I am struggling with a few issues (primarily of understanding since I am self-taught)
1) How can I detect if any of the textboxes have been edited so that I may set a flag to prompt the user along the lines of "Changes have been made - do you wish to save them" I am really try to adding an event to each text box. I have played about with OnRowChanging etc within the DataSet but have completely drawn a blank.
2) When I do make changes to the field, I am having trouble reflecting these changes back to the underlying database by using the daAdapter.Update(ds,"table") function. It simply does not work? I have got it all working by defining my own UpdateCmd and executing a cmdUpdate.ExecuteNonQuery() command. Before I do so, I have to explicitly code every textbox.Text value to my Update Command parameters. This is a b@ll-ache particularly with data records of 100+ fields.
Surely the idea of binding datasets to textBoxes is to have a two-way reflection of data? Did I miss something.
Any pointing in right directions would be most appreciated
Roger