HI there,
How to bind a cell of a dataSet to TextBox?
Thanks
Melvik.
Printable View
HI there,
How to bind a cell of a dataSet to TextBox?
Thanks
Melvik.
for a simple binding like a textbox to another textbox,
for a complex binding you should give an ICollection as the second parametre with a suitable datamember,for example I bind a dataset to a textboxCode:Binding b=new Binding("Text",textBoxA,"Text");
textBoxB.DataBindings.Add(b);
or binding an array to a textboxCode:string[] strings=new string[]{"number1","number2"};
Binding b=new Binding("Text",dataSet.Tables[0],"ColumnName");
textBox.DataBindings.Add(b);
//for changing the position of datasource(collection)
//....
this.BindingContext[dataSet.Tables[0]].Position++;
you should pass the proper parameters to the the dataSource & dataMember otherwise it won't work.Code:string[] strings=new string[]{"number1","number2"};
Binding b=new Binding("Text",strings,null);
textBox.DataBindings.Add(b);
//then for changing the position of the datasource(collection)
this.BindingContext[strings].Position++;