Reputation: 744
I have a problem with datagridview even handler, when I click at the cell i want the value in that cell send to text box, it was work but after i change something that i forgot it can't work. I've try to recreate the datagridview and its event handler but nothing. This is my code
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[1].ToString();
}
do you have any idea to fix this problem?
Upvotes: 0
Views: 225
Reputation: 1
private void gridview_CellClick(object sender, DataGridViewCellEventArgs e)
{
int r = e.RowIndex;
llenartextbox(r);
}
public void llenartextbox(int index)
{
textbox.Text = gridview.rows[index].Cells["Cliente"].Value.ToString();
}
Upvotes: 0
Reputation: 148110
You need
textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
Upvotes: 1