Hi,
I have a windows application of C# which contains two text boxes (where we are entering ID and name) and a datagridView contol. I am storing the data entered through textboxes in the table and displaying data from the tablle in the daaGridView. Now I am adding a button to update the data. Its working fine. Now I want to know the code for the following applicatiion.

"While clicking a row in the dataGridView, the corresponding values of that row should appear in the corresponding textboxes so that I can update only required fields in the record and avoid entering all fields everytime i have to update."

Since this is the dynamic event(We can click the row only when application is running), plz give me exact code.

Waiting for ur kind replies.

Recommended Answers

All 3 Replies

Capture the DataGridView CellClick or CellDoubleClick events.
In the event handler test the DataGridViewCellEventArgs RowIndex property.
Using this fill the text boxes with the correct row data.

try the selection_changed event of datagridview
the concept of current cell would be applied in this.....

try the selection_changed event of datagridview
the concept of current cell would be applied in this.....

Thanks, for your input but did you notice that this thread is over 2 years old and the problem is probably solved by now!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.