Datagridview doesn't display context menu?

B

Brett Romero

I have a simple test app with one form, one datagridview, and a
contextmenustrip. I've assigned the menustrip to the datagridview and
given the grid one column. There isn't any data in the grid. I never
see the context menu appear when I right click the grid. Any
suggestions?

Thanks,
Brett
 
P

PS

Brett Romero said:
I have a simple test app with one form, one datagridview, and a
contextmenustrip. I've assigned the menustrip to the datagridview and
given the grid one column. There isn't any data in the grid. I never
see the context menu appear when I right click the grid. Any
suggestions?

Does the context menu have any menu items?

PS
 
P

PS

Brett Romero said:
Yes - one, which is visible.

I have no idea at all then. I followed your steps exactly and it worked for
me. Start a new project and try it again.

PS
 
G

Guest

I'm don't know why the menu is not showing, but if all else fails you can
always explicitly 'Show' the menu from the RightClick event:
YourMenu.Show(System.Windows.Forms.Cursor.Position);
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
 
B

Brett Romero

Ok, my fault all the way around. At design time, I need to add a
toolstripmenuitem to my contextmenustrip. It looked like an item was
already there at design time in it's collection. But once I clicked
Add (from clicking the collection property), I saw a child appear and
new that was my mistake.

The problem at run time is the datagridview will allow you to set
grid.contextmenu and fully intialize menu items. However, I can't get
it to work at all. This property isn't available at design
time...oddly. But if you follow the above for contextmenustrip, it
also works at runtime.

Does any one know if a datagridview's context menu property actually
works, similar to a regular datagrid.contextmenu.

Thanks and sorry for the hassle,
Brett
 

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