Display Textbox
How to bind textbox to gridview/table cell when somebody clicks on gridview cell/table cell
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ashley ArgilePosted Oct 3, 2008, 8:48 AM
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
textBox1.Text = dataGridView1.CurrentCell.Value.ToString();
}
or you could bind it during form load and avoid the need to use the event handler...
private void Form1_Load(object sender, EventArgs e)
{
textBox1.DataBindings.Add("Text", dataGridView1, "CurrentCell.Value");
}
Regards
Ashley