Double-Click row in datagrid and trigger function?

T

trint

Hi,
I have three datagrids in a WinForm. I want dataGridView1 to retrieve
data and make dataGridView2 visible and the same with dataGridView3.
Any help is appreciated.
Thanks,
Trint
 
N

Nicholas Paldino [.NET/C# MVP]

Trint,

Because the DataGrid class doesn't expose double-click events which
expose which item was double clicked on, I would first sign up for the
MouseUp event. In your event handler, I would store the coordinates of the
mouse location from that event.

Then, in your DoubleClick event handler, read those coordinates. You
will want to pass them to the HitTest method on the DataGrid, which you can
use to retrieve the current cell which was double clicked on. Once you have
that, you can load the data you want for your child grid.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top