In the following code, imagine that we have a DataGridView called dgvTst and a TextBox control that called txtTst. To bind, CellClick event of DataGridView is coded as following:
private void dgvTst_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (txtTst.DataBindings.Count > 0)
txtTst.DataBindings.RemoveAt(0);
// The code binds column index 2 to the TextBox control
txtTst.DataBindings.Add(
new Binding("Text", dgvTst[2, e.RowIndex], "Value", false) );
}
2 comments:
hello Friend,
I want to need Textbox Data Binding help as your given code , I am tried to build Form. my problem is, i have two form Ist one using for watching update Datagridview and 2nd is data entries with help Textbox but update command are unable to update Ist Form DataGridview, Can you give me some help for this topic
thanks
With Regards
Amit Kumar
thxs
Post a Comment