help with datagrid

V

Vjay77

I have created a datagrid on a form.
I have put a contextmenu on the grid.
Using the mousedown event of the grid I display the contextmenu on
right clicks. The trouble I am having is that if you left click a
cell in the grid then right click the default popup comes up. If I
right click in a cell that is not selected ti works fine and
displayes my popup menu. Any help would be appreciated.
 
L

Les Smith

The problem is that what you are experiencing is the
default operation of the DataGrid. If a cell is selected,
the standard context menu will display with a right click.
I have solved the problem by selecting the row on a right-
click, and then with the whole row selected, my context
menu will popup on a right click.

I have an article on selecting a row with a rightclick at

http://www.knowdotnet.com/articles/datagridrightmouseselect
..html

If this does not do the job, send me an email and I will
give you additional code from an application that displays
a dialog form on a right click.

HTH
Les

http://www.knowdotnet.com
 

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

Similar Threads


Top