[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Datagridview doesn't display context menu?

Posted on 2006-11-02
7
Medium Priority
?
408 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:brettr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 15

Accepted Solution

by:
mattisflones earned 400 total points
ID: 17864257
A: You did something wrong..

Thats all the help you can get if you dont post code, or elaborate on the problem..
Ex: No data? Why? Was the GridView supposed to display data? How did you "assign" the menustrip to the GridView?


0
 

Author Comment

by:brettr
ID: 17864306
All of this is at design time.  There's no data because I'm just trying to get this to work in the simplest scenario.  It doesn't work in a more complex environment so I want to get at the smallest parts and work up from there.

I did all the assignments at design time so there isn't any code.  The datagridview and contextmenustrip were both dropped on a form.
0
 
LVL 8

Expert Comment

by:sabeesh
ID: 17864913
You have to set DataGrid.contextmenu property

DataGrid.contextmenu  = contextmenu
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 17865778
1) u got to have items in the contextmenu otherwise it wont popup
 2) u have to set the context menu property of data grid as ur context menu.

this should solve ur problem.
0
 

Author Comment

by:brettr
ID: 17866445
This is not a datagrid with a contextmenu.  It is a datagridview with a contextmenustrip.  The menu has menu items and I have assigned it to the grid's contextmenustrip.  No go.
0
 

Author Comment

by:brettr
ID: 17869965
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.  I'm awarding points to the first person since every one else keeps referring to a datagrid.  Please "carefully" read the post before responding.

Brett
0
 
LVL 15

Expert Comment

by:mattisflones
ID: 17870240
:-)

Crap happends...

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

It should.. atleast thats what the documentation says!


0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question