1

I have a DataGridView.
If I click over a column, it just selects a column like:

enter image description here

As you can see the Business Fax is selected, but my entire row is not, so in consequence, this.dgComm.SelectedRows.Count always throwd 0, but if I click on first column like:

enter image description here

it selects the full row and this.dgComm.SelectedRows.Count throws 1.

What I want to do is to prevent that zero. How can I select a full row if I just click in single column?

Regards.

zx485
  • 28,498
  • 28
  • 50
  • 59
Pepe
  • 111
  • 8
  • What have you tried? Please give a Minimal, Complete, and Verifiable example - https://stackoverflow.com/help/mcve – adityap Sep 17 '18 at 19:30
  • `DataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;` – Rotem Sep 17 '18 at 19:34
  • 1
    Possible duplicate of [How do I select a complete dataGridView Row when the user clicks a cell of that row?](https://stackoverflow.com/questions/13672693/how-do-i-select-a-complete-datagridview-row-when-the-user-clicks-a-cell-of-that) – Rotem Sep 17 '18 at 19:35

1 Answers1

2

There's a property on the DataGridView entitled SelectedMode, ensure this is set to FullRowSelect

Full Row Select

JEllery
  • 304
  • 2
  • 13