Textbox and databinding update issue

G

Guest

I am using VS 2003. I created a C#.NET window form and added a textbox to the
form. I set the databindings Text property to the dataset.table.field. I am
using Access database. When I ran the form, the textbox displayed the value
correctly.
I changed the textbox vale and in the texbox TextChanged event I have the
following code:
oledataAdapter1.Update(dataset_name);
but the updated value was not reflected in the Access table.
I had even tried to include the following code before the Update:
textbox.BindingContext[dataset_name].EndCurrentEdit();
and it still does not update the Access database.
I am hoping with minimum coding or setting I can make this task works.
Any idea?


It is such a simple task and I can't make it work.
 
G

Guest

After lot's of reading/research and testing, I finally figured it out. I am
sure there are other ways to solve this problem but you can use the following
code in the validated event of the textbox and IT WORKED!!
** Code in validated event
this.BindingContext[dataSetname.tablename].Position +=1;

oleDbDataAdaptername.Update(dataSetname,tablename);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top