Clearing selection in DataGridView when user clicks outside the DataGridView control

Clearing selection in DataGridView when user clicks outside the DataGridView control

Post by djyako » Sat, 18 Feb 2006 03:38:50

Dear All,

What is the best way to clear selection in the DataGrid/DataGridView
when the user clicks outside the control? For example, user clicks
inside the DataGridView, selects entire row, then clicks outside the
DataGridView to clear the selection. What events can I monitor, and
what is the best approach to solving this problem? I also want to
clear the selection if user clicks on the whitespace caused by setting
DockStyle to Fill.

Any feedback would be appreciated. I am totally stuck.


1. DataGridView (.NET 2.0 Windows Forms) Text wrapping in DataGridView Items

2. dataGridView.Rows.Count and datagridview.RowCount

Hello all,

I want to display the number of items in an datagridview. I use this
one datagridview for different datasets.

The datagridview.Rowcount works fine for the most of the dataset. But
there is one dataset which has more items
than the others and the Rowcount wont work. The result is all the time
0, but it should be something like 85.

// Datsource
this.dataGridView1.DataSource = this.REMINDERBindingSource;

// Display number of items
lbl_row.Text = dataGridView1.RowCount.ToString();
MessageBox.Show(this, dataGridView1.Rows.Count.ToString());

Has somebody an Idea? Thanks in advance.


3. Binding List<T> to a DataGridView = DataGridView Empty

4. Copy from datagridview and paste to second datagridview

5. Refreshing datagridview contents after a failed delete in bound datagridview

6. Refreshing Linq query to update second DataGridView when position in first DataGridView changes

7. DataGridView into another DataGridView

8. Datagridview - Writing Journal Transactions for a Datagridview

9. Class Inherits DataGridView, Errors: Rows(0).DataGridView

10. dataGridView.Rows.Count and datagridview.RowCount

11. Binding problems with DataGridView in User Control

12. DatagridView User Control Can not input certain characters.

13. User Control Instance/DataGridView.Columns in Visu ...

14. Using a custom user control in a datagridview cell

15. Custom (User Control?) DataGridView column