I created a context menu and bound it to the data grid
this.dataGrid1.ContextMenu = this.contextMenu1;
This works fine when I right click.

What I am trying to do is to capture the data that is in the specific DataGrid box that
the context menu was created on. I am then going to pass it to another winform.

The functionality that I am looking for is if you left click on some code in Visual Studio
and then right click and select copy. Do a paste somewere else . Whatever line you
were on was selected for the copy.

Any thoughts would be appreciated.

Dave

DavidElliott@BellSouth.net

Re: Selecting field from DataGrid when using a Context Menu by Dmitriy

Dmitriy
Wed Aug 20 01:54:29 CDT 2003

Hello David,

Upon displaying the context menu, get mouse pointer coordinates, translate
them into DataGrid's client coordinate system, perform a HitTest, determine
the row number and the column number and then query data grid's Item indexer
for the cell contents.

There probably exists a simplier solution, but here is something to at least
start your investigation with.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

"David Elliott" <DavidElliott@BellSouth.net> wrote in message
news:pfi5kvo23jiljpj9ga73ocfe9r5gnodpbu@4ax.com...
> I created a context menu and bound it to the data grid
> this.dataGrid1.ContextMenu = this.contextMenu1;
> This works fine when I right click.
>
> What I am trying to do is to capture the data that is in the specific
DataGrid box that
> the context menu was created on. I am then going to pass it to another
winform.
>
> The functionality that I am looking for is if you left click on some code
in Visual Studio
> and then right click and select copy. Do a paste somewere else .
Whatever line you
> were on was selected for the copy.
>
> Any thoughts would be appreciated.
>
> Dave
>
> DavidElliott@BellSouth.net
>
>