473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't clone ContextMenu

I have a usercontrol in which the IDE generated context menu statement is:

Friend WithEvents ContextMenuThumbnails As System.Windows.Forms.ContextMenu

I want to save the contents of it so I tried:
Private mMenuSaved As ContextMenu = Me.ContextMenuThumbnails.clonemenu

But the compiler says:

C:\Documents and Settings\Cal\My Documents\Visual Studio Projects\CAG
Studio\CAG ControlThumbnails\ControlThumbnails.vb(531):
'System.Windows.Forms.Menu.Protected Sub CloneMenu(menuSrc As
System.Windows.Forms.Menu)' is not accessible in this context because it is
'Protected'.


Is there a way to get around this?

Thanks
Nov 21 '05 #1
7 1618
Hi,

have you tried:

Private mMenuSaved As New ContextMenu
mMenuSaved = Me.ContextMenuThumbnails

Hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:Ol**************@TK2MSFTNGP12.phx.gbl...
I have a usercontrol in which the IDE generated context menu statement is:

Friend WithEvents ContextMenuThumbnails As System.Windows.Forms.ContextMenu
I want to save the contents of it so I tried:
Private mMenuSaved As ContextMenu = Me.ContextMenuThumbnails.clonemenu

But the compiler says:

C:\Documents and Settings\Cal\My Documents\Visual Studio Projects\CAG
Studio\CAG ControlThumbnails\ControlThumbnails.vb(531):
'System.Windows.Forms.Menu.Protected Sub CloneMenu(menuSrc As
System.Windows.Forms.Menu)' is not accessible in this context because it is 'Protected'.


Is there a way to get around this?

Thanks

Nov 21 '05 #2
Seems to me that would:
1) Define a new variable mMenuSaved
2) Instantiate a new ContextMenu and reference it in mMenuSaved
3)Then replace that reference with a reference to the present
ContextMenuThumbnails

That is, the end result will be a new reference to the present
ContextMenuThumbnails.

I'm not very knowadgeable about these things so I'm not sure and would like
comments, that is, either confirmation, correction, or denial or the above.

Thanks
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:uy*************@tk2msftngp13.phx.gbl...
Hi,

have you tried:

Private mMenuSaved As New ContextMenu
mMenuSaved = Me.ContextMenuThumbnails

Hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:Ol**************@TK2MSFTNGP12.phx.gbl...
I have a usercontrol in which the IDE generated context menu statement
is:

Friend WithEvents ContextMenuThumbnails As

System.Windows.Forms.ContextMenu

I want to save the contents of it so I tried:
Private mMenuSaved As ContextMenu = Me.ContextMenuThumbnails.clonemenu

But the compiler says:

C:\Documents and Settings\Cal\My Documents\Visual Studio Projects\CAG
Studio\CAG ControlThumbnails\ControlThumbnails.vb(531):
'System.Windows.Forms.Menu.Protected Sub CloneMenu(menuSrc As
System.Windows.Forms.Menu)' is not accessible in this context because it

is
'Protected'.


Is there a way to get around this?

Thanks


Nov 21 '05 #3
What exactly do you mean with
I want to save the contents of it in your first post
Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:uL**************@tk2msftngp13.phx.gbl... Seems to me that would:
1) Define a new variable mMenuSaved
2) Instantiate a new ContextMenu and reference it in mMenuSaved
3)Then replace that reference with a reference to the present
ContextMenuThumbnails

That is, the end result will be a new reference to the present
ContextMenuThumbnails.

I'm not very knowadgeable about these things so I'm not sure and would like comments, that is, either confirmation, correction, or denial or the above.
Thanks
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:uy*************@tk2msftngp13.phx.gbl...
Hi,

have you tried:

Private mMenuSaved As New ContextMenu
mMenuSaved = Me.ContextMenuThumbnails

Hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:Ol**************@TK2MSFTNGP12.phx.gbl...
I have a usercontrol in which the IDE generated context menu statement
is:

Friend WithEvents ContextMenuThumbnails As

System.Windows.Forms.ContextMenu

I want to save the contents of it so I tried:
Private mMenuSaved As ContextMenu = Me.ContextMenuThumbnails.clonemenu

But the compiler says:

C:\Documents and Settings\Cal\My Documents\Visual Studio Projects\CAG
Studio\CAG ControlThumbnails\ControlThumbnails.vb(531):
'System.Windows.Forms.Menu.Protected Sub CloneMenu(menuSrc As
System.Windows.Forms.Menu)' is not accessible in this context because
it is
'Protected'.


Is there a way to get around this?

Thanks



Nov 21 '05 #4
Did you mean to send this to someone else?
I don't see
I want to save the contents of it in your first post in my post.
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:uc**************@TK2MSFTNGP15.phx.gbl...
What exactly do you mean with
I want to save the contents of it in your first post


Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:uL**************@tk2msftngp13.phx.gbl...
Seems to me that would:
1) Define a new variable mMenuSaved
2) Instantiate a new ContextMenu and reference it in mMenuSaved
3)Then replace that reference with a reference to the present
ContextMenuThumbnails

That is, the end result will be a new reference to the present
ContextMenuThumbnails.

I'm not very knowadgeable about these things so I'm not sure and would

like
comments, that is, either confirmation, correction, or denial or the

above.

Thanks
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:uy*************@tk2msftngp13.phx.gbl...
> Hi,
>
> have you tried:
>
> Private mMenuSaved As New ContextMenu
> mMenuSaved = Me.ContextMenuThumbnails
>
> Hth Greetz Peter
>
>
> --
> Programming today is a race between software engineers striving to
> build
> bigger and better idiot-proof programs, and the Universe trying to

produce > bigger and better idiots. So far, the Universe is winning.
>
> " **Developer**" <RE*************@a-znet.com> schreef in bericht
> news:Ol**************@TK2MSFTNGP12.phx.gbl...
>> I have a usercontrol in which the IDE generated context menu statement
>> is:
>>
>> Friend WithEvents ContextMenuThumbnails As
> System.Windows.Forms.ContextMenu
>>
>>
>>
>> I want to save the contents of it so I tried:
>> Private mMenuSaved As ContextMenu = Me.ContextMenuThumbnails.clonemenu
>>
>>
>>
>> But the compiler says:
>>
>> C:\Documents and Settings\Cal\My Documents\Visual Studio Projects\CAG
>> Studio\CAG ControlThumbnails\ControlThumbnails.vb(531):
>> 'System.Windows.Forms.Menu.Protected Sub CloneMenu(menuSrc As
>> System.Windows.Forms.Menu)' is not accessible in this context because it > is
>> 'Protected'.
>>
>>
>>
>>
>> Is there a way to get around this?
>>
>>
>>
>>
>>
>> Thanks
>>
>>
>
>



Nov 21 '05 #5

" **Developer**" <RE*************@a-znet.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...
Did you mean to send this to someone else?
I don't see
I want to save the contents of it in your first post

in my post.

Sorry, I can't believe I missed what this says.

Any way, I just meant I didn't want a new reference to the same data memory
locations but wanted a new variable that reference a new set of data.
Nov 21 '05 #6
Hi sorry for the late response,

do you mean something like this:

Dim newCM As New ContextMenu
Dim miNew As MenuItem
For Each mi As MenuItem In ContextMenu1.MenuItems
miNew = New MenuItem(mi.Text)
newCM.MenuItems.Add(miNew)
Next

hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:#s**************@TK2MSFTNGP09.phx.gbl...

" **Developer**" <RE*************@a-znet.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...
Did you mean to send this to someone else?
I don't see
I want to save the contents of it in your first post in my post.

Sorry, I can't believe I missed what this says.

Any way, I just meant I didn't want a new reference to the same data

memory locations but wanted a new variable that reference a new set of data.

Nov 21 '05 #7
I'll have to study this.

Thanks
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:uE**************@TK2MSFTNGP14.phx.gbl...
Hi sorry for the late response,

do you mean something like this:

Dim newCM As New ContextMenu
Dim miNew As MenuItem
For Each mi As MenuItem In ContextMenu1.MenuItems
miNew = New MenuItem(mi.Text)
newCM.MenuItems.Add(miNew)
Next

hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:#s**************@TK2MSFTNGP09.phx.gbl...

" **Developer**" <RE*************@a-znet.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...
> Did you mean to send this to someone else?
> I don't see
>>>I want to save the contents of it in your first post
> in my post.
>
>

Sorry, I can't believe I missed what this says.

Any way, I just meant I didn't want a new reference to the same data

memory
locations but wanted a new variable that reference a new set of data.


Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MD | last post by:
I have a ContextMenu that is assigned to 3 RichTextBox's (i.e., if you right-click on any of the 3 RichTextBox's, you get the same ContextMenu). My ContextMenu has 2 items, each of which have their...
1
by: MrNobody | last post by:
For the the sake of keeping my code simple, I wanted a ContextMenu and a MainMenu to share some MenuItems, but it turns out when I Add() one MenuItem to the other it 'steals' that MenuItem so it...
9
by: I_AM_DON_AND_YOU? | last post by:
I have written a VB.Net program. This program has a ConetxtMenu1. ContextMenu1 is very big and has many levels. There are so many procedures and depending upon the logic many times a menu item...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
3
by: Libby Sharf | last post by:
Hello, I have several ContextMenus and I want to connect them to the GridControl's ContextMenu property depending on the row that was right clicked. Is there an event that is raised just before...
0
by: Steve Richter | last post by:
I cant get a contextmenu to popup in the context of a datagridview. It pops up in the ListBox, and in the form itself. But not the DataGridView. How could that be? here is my code: using...
2
by: Academia | last post by:
In an old project I still use MainMenu and ContexMenu. How can I get them to appear in my Toolbox? Thanks
0
by: snehal12345 | last post by:
I have created 1 contextmenu for a listbox in C#.net 3.0 . For that context menu I have written one event handler for mouseup event . But when i click on contextmenu item that event is not captured....
3
by: asharda | last post by:
Hi, I am trying to create a context menu in my application. The context menu takes menu otems from an XML file. In XAML the code is <Grid.ContextMenu> <ContextMenu Name="cm" StaysOpen="true"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.