Home All Groups Group Topic Archive Search About

Inherited Menus and Modifiers

Author
28 Jun 2005 4:07 PM
Buzz
I am using VB.NET

Before I chase this ellusive bug, I want to confirm it is not a framework
issue. I have a base form with a Menu. I have set the menu and each of its
menu items to have Modifiers of Protected Friend.

However, the child form shows the menu and its items as being Private.

Is a know bug with the framework? If so, workarounds? If not, could it be
that my resx are out of wack?

Thanks,
Buzz.
Author
29 Jun 2005 1:39 AM
Jeffrey Tan[MSFT]
Hi Buzz,

Thanks for your post.

I am not sure I understand you very well. I have created a VB.net Winform
application, then placed 1 mainmenu components to that form, modify its
Modifier like this:

Protected Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Protected Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Protected Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Protected Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem

Then I add an inherited form which inherits from the base form. However, in
the inherited form code file, we can not see any MenuItem references,
because they are kept in base form's instance. We can access these
references in the inherited form without any problem(because of protected
Modifier):

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
    Me.MenuItem1.Text = "Change"
End Sub

So I do not know where does the "Private" Modifier come from. Can you give
us more clarify on this? Thanks
==============================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Are all your drivers up to date? click for free checkup

Author
29 Jun 2005 4:26 PM
Buzz
Hi Jeffrey,

You'll be able to easily see and create the bug if you do this through the
IDE.

) Create a VB.NET WinForm app
) On Form1:
  - Add a Menu
  - Add a menu item and call it File
  - Add a menu item to File and call it New
) Set the modifiers for the main menu and two menu items to Protected Friend
either through the F4 Properties window or through code.
) Build the project
) Add a new form that inherits from Form1.
) Now, open Form2 and this is where it gets interesting:
   - From the GUI, click on the menu or one of its items and look at the F4
Properties. You'll see the Modifers is greyed out and it says Private.
) Still on Form2 and in the GUI, add a menu item beneath New and call it Child
) Drag Child above New
) Set the project to run Form2 and run the project
) You'll get a vague argument exception that says, "'1' is not a valid value
for 'value"
) If you set exceptions to break into the debugger you'll see it is crapping
out in InitializeComponent on setting the menuItem2.Index (the New menu item
inherited from Form1). I am guessing because it thinks the modifier is set to
Private.

I hope you'll be able to reproduce this or have some guesses on what I could
be doing wrong.

I am using .NET 1.1 SP1 with VS2003.

Thanks,
Buzz


""Jeffrey Tan[MSFT]"" wrote:

Show quoteHide quote
> Hi Buzz,
>
> Thanks for your post.
>
> I am not sure I understand you very well. I have created a VB.net Winform
> application, then placed 1 mainmenu components to that form, modify its
> Modifier like this:
>
> Protected Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
> Protected Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
> Protected Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
> Protected Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
>
> Then I add an inherited form which inherits from the base form. However, in
> the inherited form code file, we can not see any MenuItem references,
> because they are kept in base form's instance. We can access these
> references in the inherited form without any problem(because of protected
> Modifier):
>
> Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>     Me.MenuItem1.Text = "Change"
> End Sub
>
> So I do not know where does the "Private" Modifier come from. Can you give
> us more clarify on this? Thanks
> ==============================================================
> Thank you for your patience and cooperation. If you have any questions or
> concerns, please feel free to post it in the group. I am standing by to be
> of assistance.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>
>
Author
30 Jun 2005 7:21 AM
Jeffrey Tan[MSFT]
Hi Buzz,

Thanks for your feedback.

Yes, with your further input, I have reproduced out your problem. Actually,
this is not a VB.net designer issue, I can also reproduce it out on VC#.net
designer. Additionally, I tested other Modifiers, such as public,
protected, private etc.., all works well.

Then after doing some search in our internal database, I found that this is
confirmed known issue, which is documented in an internal bug table. It is
said to be fixed in Whidbey Beta2.

Hope this information helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Author
30 Jun 2005 8:09 AM
Buzz
It is helpful but of course not useful.

With many vague bugs I've come across the last few months, I wish the Vs
team would have bucked up to the dragging deadline of 2K5 and released
framework 1.5. These bug fixes tied to a major release I won't be using well
into 2006 and on other projects is, well, useless :)

""Jeffrey Tan[MSFT]"" wrote:

Show quoteHide quote
> Hi Buzz,
>
> Thanks for your feedback.
>
> Yes, with your further input, I have reproduced out your problem. Actually,
> this is not a VB.net designer issue, I can also reproduce it out on VC#.net
> designer. Additionally, I tested other Modifiers, such as public,
> protected, private etc.., all works well.
>
> Then after doing some search in our internal database, I found that this is
> confirmed known issue, which is documented in an internal bug table. It is
> said to be fixed in Whidbey Beta2.
>
> Hope this information helps.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>
>
Author
1 Jul 2005 6:23 AM
Jeffrey Tan[MSFT]
Hi Buzz,

Thanks for your feedback.

VS.net2005 will use the .Net Framework2.0, not 1.5.

Yes, I see your concern. Actually, for any bugs reported in the newsgroup,
many of them are known issues, which is documented in our internal product
database. For the undocumented reported bugs, I have helped the community
members to forward to our product team. This is currently I can do for you.

For your concern, I suggest you forward it to our product team directly,
you can forward it with the link below:
"http://register.microsoft.com/mswish/suggestion.asp"

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Author
19 Dec 2005 9:47 PM
MycGyver
Doesn't look like VS2005 supports inherited menus.  :-(

Show quoteHide quote
"Buzz" wrote:

> It is helpful but of course not useful.
>
> With many vague bugs I've come across the last few months, I wish the Vs
> team would have bucked up to the dragging deadline of 2K5 and released
> framework 1.5. These bug fixes tied to a major release I won't be using well
> into 2006 and on other projects is, well, useless :)

Bookmark and Share