DataBindings between a TextBox and a DataGridView

Aug 4 2008 11:24 AM
I have a form which includes a DataGridView and some TextBoxes. Most of the TextBoxes are filled with a classic query to an Oracle database (with an OleDbConnection object). The DataGridView is well filled with an OleDbDataAdapter. I want to complete 4 of my text boxes with a DataBinding linked to my DataGridView. I did this :

txtDepIdDep.DataBindings.Add("Text", dgridDepart[0, e.RowIndex], "Value", false, DataSourceUpdateMode.OnPropertyChanged);

where txtDepIdDep is my TextBox, dgridDepart is my DataGridView and e.RowIndex my current row (I run this command in a CellEventHandler, ie each time I selected a new row, I have to update these 4 text boxes).

The problem is : when I add these DataBindings, the other text boxes (those who are filled with a classic connection) do not work anymore : there is not text inside them, although with no DataBindings objects, it works very well.

Why a property of a TextBox can affect properties of other TextBoxes ?

Thanks a lot for your replies.

Answers (8)