user628347
user628347

Reputation: 201

How to get the value which is selected in gridview?

When I click on a row I should get the value on which the user is clicked

How do I get that?

Upvotes: 1

Views: 682

Answers (3)

Craig Eddy
Craig Eddy

Reputation: 959

If the grid's SelectionMode is set to FullRowSelect or FullHeaderSelect, you can get the selected row(s), using

DataGridView.SelectedRows

Then for each row you can use the Cells property to get the values.

There are a wide variety of ways to get at the underlying data set.

Upvotes: 0

Neil Knight
Neil Knight

Reputation: 48537

If I have understood you correctly, then you'll want the SelectedIndexChanged event.

Upvotes: 1

Oliver
Oliver

Reputation: 45071

How about one of these event:

Upvotes: 1

Related Questions