Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Context Menu Problems


Reply
 
Thread Tools Display Modes
  #1  
Old 01-24-2004, 11:40 PM
SolarCoasters SolarCoasters is offline
Centurion
 
Join Date: Oct 2002
Location: Florida
Posts: 164
Default Context Menu Problems


I made a context menu that I only want to pop up when a user right clicks on the grid. My book says that a context menu will pop up on any right click anywhere on the form. How do I make the menu pop up only when the user right clicks when over the msflexgrid control?
Thank you
Reply With Quote
  #2  
Old 01-26-2004, 08:08 AM
Machaira's Avatar
Machaira Machaira is offline
Jedi Coder

* Expert *
 
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438
Default

Your book is incorrect. Only certain controls automatically have context menus associated with them. Since the MSFlexGrid is not a .NET control I believe you would have to display the menu manually:
Code:
Private Sub AxMSFlexGrid1_MouseDownEvent(ByVal sender As Object, ByVal e As AxMSFlexGridLib.DMSFlexGridEvents_MouseDownEvent) Handles AxMSFlexGrid1.MouseDownEvent If e.button = 2 Then ContextMenu1.Show(Me, New Point(AxMSFlexGrid1.Left + e.x, AxMSFlexGrid1.Top + e.y)) End If End Sub Private Sub MenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem1.Click, MenuItem2.Click, MenuItem3.Click MsgBox(sender.text) End Sub
Note that using the FlexGrid control in the Show method of the ContextMenu doesn't seem to work for calling the Click event of the menuitems, at least for me it didn't.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Context Menu hskohli API 8 11-18-2003 09:09 AM
Select item in context menu of another application hskohli API 0 11-12-2003 07:36 PM
Menu Problems Megazoid API 1 11-11-2002 11:18 AM
Few Questions dealing with pictures crazycheetah General 21 06-17-2002 11:08 PM
VB Menus John General 8 02-05-2002 09:31 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->