Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a gridview.on clicking a particular cell i need to take the values from gridview to textboxes in same form..how to do that???
Posted

Use the properties of the GridView to extract the relevant item (converting to a string if necessary). Use the Text property of the TextBox to display the result.
 
Share this answer
 
you can use CellContentClick Event of DataGridView.
Hope this will help you.

C#
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
     txtName.text=DataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900