Although confusing the question, I believe you want to get a value from a certain datagrid field and send it to a textbox, the event is called row.selected, I'll explain it best:
Suppose we have a table called GridClients and it contains 2 columns "id" and "name", to send the value of "id" to a textbox, you should use the following code:
idclient.Text = GridClientes.CurrentRow.Cells[0].Value.ToString();
The value of the cell is counted from 0, so ... if I have 2 fields, they are Cells [0] and Cells [1].
This code can be called inside the event of a button:
private void button1_Click(object sender, EventArgs e)
{
idClient.Text = GridClientes.CurrentRow.Cells[0].Value.ToString();
}
When a table cell is selected:
private void GridClientes_CellEnter(object sender, DataGridViewCellEventArgs e)
{
idClient.Text = GridClientes.CurrentRow.Cells[0].Value.ToString();
}
Or when an entire row of the table is selected (need to configure this feature):
private void GridClientes_RowEnter(object sender, DataGridViewCellEventArgs e)
{
idClient.Text = GridClientes.CurrentRow.Cells[0].Value.ToString();
}
I hope I have helped.