Ok if you add a menu thru the menueditor that is at designtime. If you want to add menu items after your program is compiled then this is adding at runtime. If you open the frmpopup form and goto tools/menueditor, u will see the popup items. u may add more popups there. if u want to add to it after your program is compiled, search on the forums theres plenty of examples
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
ooh ok i get u now. What you can do is use the Mouse_Event API to send a mouseclick to the flexgrid before popping up the menu at point where the right click event happened then right after that put the code to popup the menu. Try this example below.
Add The Below To Your Declarations In Your Form
VB Code:
Private Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetCursorPos Lib "user32.dll" (ByVal X As Long, ByVal Y As Long) As Long
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
then delete whatever code you have in the Mouse_Down even of the flexgrid and add this bit of code to the Mouse_Down event of the flexgrid.
[Highlight=VB]
If Button = 2 Then
DoEvents
Call mouse_event(MOUSEEVENTF_LEFTDOWN, X, Y, 0, 0)
Call mouse_event(MOUSEEVENTF_LEFTUP, X, Y, 0, 0)
DoEvents
frmpopup.PopupMenu frmpopup.mnupopup
End If
[Highlight=VB]
there you go, all this does is sends a left click before the menu pops up. I don't know if this is the right way to do it, but it works.
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)