-
Jan 28th, 2013, 09:42 AM
#1
Thread Starter
Fanatic Member
unloading popup menuitem error
when ever i try to unload a menu item from the popup menu item under combbox click event like this
vb Code:
For i = mnuTCategory.Count - 1 To 1 Step -1
Unload mnuTCategory(i)
Next
I get this error "Unable to unload within this context". Can someone show me how to do this
-
Jan 28th, 2013, 11:33 AM
#2
Re: unloading popup menuitem error
Never worked this before...but will research...Can you remove ONE item, like: unload mnuTCategory(2) ? In meantime, will check this out.
-
Jan 28th, 2013, 12:00 PM
#3
Re: unloading popup menuitem error
Well, after just an initial research and test, if mnuTCategory is the name of your invisible top menuitem (which you display using the popupmenu function), then it has no .count property. So that approach would be incorrect from the start. Still researching (are you?)
-
Jan 28th, 2013, 12:12 PM
#4
Re: unloading popup menuitem error
Not sure if this will work for you, however, it is a solution of sorts.
First, I have a listbox and a commandbutton on my form...
I then have a menu item called: MnuListPopup
Under that, I have two additional sub-menus: mnuHide and mnuShow
(created that using the menuEditor, and of course set MnListPopup to NOT visible---leaving the two sub menus as VISIBLE)
Then I put in this code on the listbox:
Code:
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Button And vbRightButton Then
PopupMenu MnuListPopup
End If
End Sub
Then, in my example, I put the cmd button's click event as:
Code:
mnuHide.Visible = False
Before clicking the button, I see both Hide and Show options when I right click on my list box
After clicking the buttion, of course I only see the Show option (as mnuHide is now invisible).
Can you use this approach somehow?
-
Jan 28th, 2013, 02:33 PM
#5
Thread Starter
Fanatic Member
Re: unloading popup menuitem error
Last edited by coolcurrent4u; Jan 28th, 2013 at 03:00 PM.
-
Jan 28th, 2013, 02:50 PM
#6
Thread Starter
Fanatic Member
Re: unloading popup menuitem error
thanks for your response, the top menu created in design mode is mnuTCategories,
In the submenu mnuTCategory, i added one item mnuTCategory(0) at design time and the rest loaded at runtime .
so in total mnuTCategory contacts 3 menus. but i cannot unload any of them at runtime
what am doing is removing all and reloading another set of items, but it wont allow me to do that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|