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
[quoted text, click to view] ""Jeffrey Tan[MSFT]"" wrote:
> 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.
>