From: Matthijs de Z on
>Pete wrote:
> It seems to me that
> your click handler really should just look like this:
>
>    private void dataGridView1_CellMouseClick(object sender,
> DataGridViewCellMouseEventArgs e)
>    {
>      if (e.RowIndex >= 0)
>      {
>        DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
>
>        row.Selected = !row.Selected;
>      }
>    }

Hi Pete,

thanks for looking into the problem.

with the code above, I'm not able to select multiple rows by just
clicking them. That’s why I used the List (to keep track of rows
already selected, or in case you click on a row again, deselect it).

the thing is, that when i click on a cell in a row, i can see that it
takes some time to select the whole row. It's not done
instantaneously. And the thing is....I can only see it on the row I
click on....the other rows (even those who are already selected) don't
show this behavior.

I'll play around with it today some more. If I found out what the
problem was, I'll post it here.
Regards,

Matthijs

> If at any point you actually need a list of just the rows that are
> selected, you can use the DataGridView.SelectedRows property.
>
> Pete

From: Matthijs de Z on
Pete,

I've changed the project and now use a axtra column with a checkbox.
When you click a row, the checkbox will be checked (or unchecked) and
I will not use multiple selections anymore.
regards,

Matthijs
From: Peter Duniho on
Matthijs de Z wrote:
> Pete,
>
> I've changed the project and now use a axtra column with a checkbox.
> When you click a row, the checkbox will be checked (or unchecked) and
> I will not use multiple selections anymore.
> regards,

I would expect that there's a way for you to override the selection
behavior when clicking (I assume the problem you mean is that the
control is already unselecting the current selection on a plain click).
Having done that, the code I suggested should work fine.

But a check box should be fine too, if you're happy with that.

Pete