Hello Bill,
Use the MouseUp event (or MouseDown, depending on what you want to do upon a
click) and then use the HitTest method on the grid instance to determine
whether the user has clicked on a cell, on a row header, on a column header
etc.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Bill Styles" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I've been trying to do some work with a datagrid control on a winform and
> have gotten very frustrated with it. I need to be able to determine when
> the user clicks on a given cell but can't find anything that seems to be
> reliable.
>
> The click and doubleclick events fire when the user clicks on the row or
> column headers and *sometimes* when the user clicks on a particular cell.
I
> can't figure out any pattern to when it fires by clicking on a cell.
>
> The CurrentCellChanged fires when the user clicks on a cell but ALSO when
> the user clicks on a different row or column header so if they select a
cell
> and then click a column header to sort differently then it changes the
> selection. I need to identify the last cell selected only and not have it
> be affected by row or column clicks.
>
> There are a lot of other things that should be simple that the datagrid
> seems to make as difficult as possible but I've managed to work around
> everything so far except the ability to select a cell. Any ideas will be
> appreciated.
>
> --
> C# newbie... posts are probably inaccurate, inelegant or both
>