0
Answer

[Updated] DataGridView Click Events...

Ask a question
Tony

Tony

16y
5.7k
1
Hello to all,

I have a DataGridView which has MouseDown and a CellContentDoubleClick events tied to it.  Now I'm trying to assign a MouseUp event to this DataGridView as well.  The problem I'm trying to figure out is why the MouseUp event only fires once after selecting a row in the grid and not again after selecting another row in the same grid.  So essentially I select one row for the first time in the DataGridView and the MouseUp event fires, I then select another row in the same grid but the MouseUp doesn't fire.

Any idea why the MouseUp wouldn't fire again?

Thanks for your time.

- Tonez

-------

UPDATE:  I haven't found an explanation for the above problem I mentioned but I have found another event which fires everytime a different row in the same DataGridView is clicked - it's the RowEnter event.  Basically what I want is to get cell data from the row the user has clicked on, so naturally a click event would be perfect for this, the only drawback in using the RowEnter event in my case is that it fires upon populating the DataGridView, it's a drawback for me mainly because I have code trying to get the selected row's cell data in the RowEnter handler - so I get an error cause no row is selected upon populating the grid - I've avoided the error simply by checking to see if the user has selected any rows. 

So using the RowEnter event serves my purpose but if anyone could explain why the click event handlers of the DataGridView only execute once after selecting a row and not again after selecting a different row in the same grid that would be grand :).