Although confusing the question, I believe you want to get a certain datagrid field value and send it to a textbox, the event is called Row.Selected, I will explain better:
Suppose we have a table called Gridclientes and it contains 2 columns "id" and "name", to send the value of "id" to a textbox, we must use the following code:
idclient.Text = GridClientes.CurrentRow.Cells[0].Value.ToString();
the cell value is counted from 0, so... if I have 2 fields, they are Cells[0] and Cells[1].
This code can be called inside a button event:
private void button1_Click(object sender, EventArgs e)
{
idClient.Text = GridClientes.CurrentRow.Cells[0].Value.ToString();
}
When a cell in the table 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 (you need to configure this feature):
private void GridClientes_RowEnter(object sender, DataGridViewCellEventArgs e)
{
idClient.Text = GridClientes.CurrentRow.Cells[0].Value.ToString();
}
I hope I’ve helped.
Documentation of Gridcontrol events.
– Oralista de Sistemas
Yes, but in the description of those events it is not clear, and using the link still does not answer the second part of the question, as I search the data of Gridcontrol.
– Flávio Naves Jr