-1

I have a winform which display datatable

enter image description here

33  Bulbasaur   Seed Pokémon    A strange seed was planted on its back at birth. The plant sprouts and grows with this POKéMON. 8.4 146.5
34  Ivysaur Seed Pokémon    When the bulb on its back grows large, it appears to lose the ability to stand on its hind legs.    3.6 182.9
35  Venusaur    Seed Pokémon    The plant blooms when it is absorbing solar energy. It stays on the move to seek sunlight.  10.2    52.5

Once I clicked row 33, I just want to have its information.

DataTable dtbl = new DataTable();
DataRow[] dtr = dtbl.Select();

This dtr contains all of three entries. How can I have only one row which I select? I know how to get specific row, but not the selected by the user click.

jayko03
  • 2,329
  • 7
  • 28
  • 51

1 Answers1

-1

Is this a DataGridView or a GridView? DataTables are the information behind them, not the object themselves. My guess is that you're using a DataGridView. If you are what you're looking for is:

((DataRowView)[DataGridView name].SelectedRow.DataBoundItem).Row
Frank Ball
  • 1,039
  • 8
  • 15
  • It is none of DataGridView nor GridView. It is datatable. – jayko03 Nov 27 '18 at 19:59
  • A DataTable is an object containing data organized into a format using rows and columns. It has no UI and thus no way to select a row via a mouse click. Click on the object in question and in the "Properties" panel, look at the top of the panel. You'll see the name you assigned to the object (or it's default name), followed by the object's type. Let us know what this value is, please. – Frank Ball Nov 27 '18 at 21:28