I decided not to use bindingSource class but implement binding functionality on my windows form application. I succeed to some points but little complication occurs. I would like to find out the reason. I have DataTable filled from datasource and three controls: textbox1, textbox2, checkedBox1. I managed to bind the controls and show the values by;
txtBox1.DataBindings.Add("Text", myTable, "NAME", true, DataSourceUpdateMode.Never);
As you guess, myTable is the datatable contains the data filled from database table. I can get the current row values with CurrencyManager, such as;
DataRow dr = ((DataRowView)this.BindingContext[myTable].Current).Row;
But when i want to change the values using current row, somehow after first field set, others automatically changes to prior values. I mean:
dr["NAME"]= textBox1.Text;
dr["SURNAME"] = textBox2.Text; //this set seems useless
First assignment works but then form controls that textBox2, checkBox1 changes their values back to original before the editing begins. So i can not update the full row in this way.
On the other hand, with using BindingSource i would get the current row similar style:
DataRow drB = ((DataRowView)bindingSource1.Current).Row;
And change the fields of this row by:
drB["NAME"] = textBox1.Text;
drB["SURNAME"] = textBox2.Text;
drB["ACTIVE"] = checkBox1.Checked;
with ending the edit with:
bindingSource1.EndEdit();
All table is ready to update because whole row changed successfully. I would like to see the difference, and manage it without using bindingSource. Does it mean that I should use something EndEdit() does? What am I missing, or forget the obsession?