Binding to TextBoxes on MySQL with C#

J

jwitt

Ref: WinXP SP2, MySQL 5.0, .NET 1.1, C#

I try to bind columns to TextBoxes. The column data appears in the
textboxes, but if modified will not update. My code came from MySQL
example, which uses a datagrid. If cols in the datagrid are modified
they update fine.

The following code:

DataTable changes;


changes = this.data.GetChanges();
x = 1;
this.da.Update( changes );
this.data.AcceptChanges();

yields the error "Value cannot be null", as I guess 'changes' is null
because nothing in the DataGrid has changed.

So, how to get the TextBox bindings to yield non-null 'changes'

FYI: 'data' is a DataTable, 'da' is MySQLDataAdapter

Thanks!
 
C

Cor Ligthert [MVP]

jwitt,

Mostly will help you to do a endcurrentedit in version 1.x (AFAIK does
EndEdit now the same in 2.0) to push the data down in the datasource, what
is standard only done by a rowchange.

typed here so watch typos or whatever

Therefore before your update
\\\
Bindingcontext[this.data].EndCurrentEdit();
///

I hope this helps,

Cor
 

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