Display Textbox
How to bind textbox to gridview/table cell when somebody clicks on gridview cell/table cell
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ashley Argile97 reputationPosted Oct 3, 2008, 4:48 AM EDT
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