PDA

Click to See Complete Forum and Search --> : Binding Data


Luis Moises Rojas
Dec 28th, 2005, 08:29 AM
What is wrong in this?

Binding handlerBalance = new Binding("Text", dtcatalogo, "balance_inicial");
handlerBalance.Format+=new ConvertEventHandler(MoneyTostring);
handlerBalance.Parse+=new ConvertEventHandler(stringToMoney);
txtbalance_inicial.DataBindings.Add(handlerBalance);

When i try to run the program i got an error.
I have the same on other program and everything is ok.
Any hlp?

Hack
Dec 28th, 2005, 08:30 AM
What is the error that you are getting, and where are you getting it?

Luis Moises Rojas
Dec 28th, 2005, 08:57 AM
What is the error that you are getting, and where are you getting it?

This is the code:

private void BindData_to_Text()
{
txtnumero_cuenta.DataBindings.Add("Text", dtcatalogo, "Numero_Cuenta");
txtdescripcion.DataBindings.Add("Text", dtcatalogo, "descripcion");

Binding handlerBalance = new Binding("Text", dtcatalogo, "balance_inicial");
handlerBalance.Format+=new ConvertEventHandler(MoneyTostring);
handlerBalance.Parse+=new ConvertEventHandler(stringToMoney);

txtbalance_inicial.DataBindings.Add(handlerBalance);
}

This is the error;
An unhandled exception of type 'System.ArgumentException' occurred in System.windows.forms.dll

Additional information: cannot bind to property or column balance_inicial on datasource

With the first two(2) lines everything is ok and i get not error.

Luis Moises Rojas
Dec 28th, 2005, 11:37 AM
This is the code:

private void BindData_to_Text()
{
txtnumero_cuenta.DataBindings.Add("Text", dtcatalogo, "Numero_Cuenta");
txtdescripcion.DataBindings.Add("Text", dtcatalogo, "descripcion");

Binding handlerBalance = new Binding("Text", dtcatalogo, "balance_inicial");
handlerBalance.Format+=new ConvertEventHandler(MoneyTostring);
handlerBalance.Parse+=new ConvertEventHandler(stringToMoney);

txtbalance_inicial.DataBindings.Add(handlerBalance);
}

This is the error;
An unhandled exception of type 'System.ArgumentException' occurred in System.windows.forms.dll

Additional information: cannot bind to property or column balance_inicial on datasource

With the first two(2) lines everything is ok and i get not error.

My friends, the problem was on the dataset.
Because, i have: select x1,x2 from table but the fields balance_inicial was not on the select.