main menu disappearred

  • Thread starter Thread starter GS
  • Start date Start date
G

GS

the main menu in the application seemed to disappeared all together until I
click on an control and select mainmenu1 in designer. then the mainmenu1
displays where it should be but running it or deselecting the mainmenu1, the
menu disappears again.


what can I do. to fix the problem
 
thanks
both.
1
in design mode, the main menu does not show up. Unless I click on any
control to select property,, and then scroll to Mainmenu1, I will then see
the main menu. if the current control is no men menu, I will not see main
menu in designer.

2. when running, no main menu either
 
Have you restarted VS? Or, your computer?
Have you tried creating a new form and placing a main menu on that?
Sometimes VS has hicups when your program gets big.
Do you use VS2003 or VS 2005?
 
gs said:
thanks
both.
1
in design mode, the main menu does not show up. Unless I click on any
control to select property,, and then scroll to Mainmenu1, I will then see
the main menu. if the current control is no men menu, I will not see main
menu in designer.

2. when running, no main menu either

Is it possible that you accidentally "hide" your Mainmenu behind some
other Controls or Containers (A Panel, GroupBox or whatever)?
Stupid question, I know - But this was the only way for me to create
this problem...
 
Ryan S. Thiele said:
Have you restarted VS? Or, your computer? Yes both
Have you tried creating a new form and placing a main menu on that?
in the same project or different project?
Sometimes VS has hicups when your program gets big.
is 107kb big? I have 2 GB of ram. about 850GB of commit/charge useage
between VS2005 express and a running virtual PC
I even trying running VS only after reboot still messed up the main menu. I
guess there is no way it will let me add nother main menu on other form in
teh project. it is possible to add a menu strip to another form
Do you use VS2003 or VS 2005?
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: VB Express

Microsoft Visual Basic 2005 76541-000-0000011-.....
Microsoft Visual Basic 2005

Hmmm, actually I don't see any way to add mainmenu through the designer. no
mainmenu but "menu" in the toolbox.


If I start up a new prject, I don't see main menu either even in code as
system.windows.form..mainmenu

I believe there was an dotnet update not too long ago
 
thank you for your patience.

I thought about this. but if hidden then only behind the form. I was
looking at the attribute to bring forward but failed.

when I don't see the main menu in designer, click on he spot where the main
menu should be and select property, I got the main form shown in the
property box.

So, how do I unhide the main menu?
 
oh, btw, I went to code and extract the code for mainenu


'Required by the Windows Form Designer

Private components As System.Component.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu

....


<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.components = New System.ComponentModel.Container

Dim resources As System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(FormMyApp))

Me.MainMenu1 = New System.Windows.Forms.MainMenu(Me.components)

Me.fileMI = New System.Windows.Forms.MenuItem

Me.openMI = New System.Windows.Forms.MenuItem

Me.printMI = New System.Windows.Forms.MenuItem

Me.MenuItem6 = New System.Windows.Forms.MenuItem

Me.exitMI = New System.Windows.Forms.MenuItem

Me.editMI = New System.Windows.Forms.MenuItem

Me.cutMI = New System.Windows.Forms.MenuItem

Me.copyMI = New System.Windows.Forms.MenuItem

Me.pasteMI = New System.Windows.Forms.MenuItem

Me.MenuItem12 = New System.Windows.Forms.MenuItem

Me.findMI = New System.Windows.Forms.MenuItem

Me.viewSourceMI = New System.Windows.Forms.MenuItem

Me.toolsMI = New System.Windows.Forms.MenuItem

Me.internetOptionsMI = New System.Windows.Forms.MenuItem

Me.helpMI = New System.Windows.Forms.MenuItem

Me.aboutMI = New System.Windows.Forms.MenuItem

Me.contextMenu = New System.Windows.Forms.ContextMenu

....

'MainMenu1

'

Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem()
{Me.fileMI, Me.editMI, Me.toolsMI, Me.analyseMI, Me.searchMI, Me.helpMI})

'

'fileMI

'

Me.fileMI.Index = 0

Me.fileMI.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.openMI,
Me.printMI, Me.MenuItem6, Me.exitMI})

Me.fileMI.Text = "File"

'

'openMI

'

Me.openMI.Index = 0

Me.openMI.Text = "&Open..."

'

'printMI

'

Me.printMI.Index = 1

Me.printMI.Text = "&Print..."

.......
 
it looks as if the menu is not included in the controlcolleciton.

Find a line the says something close to:

MyForm.Controls.AddRange(New Control() {AControl,AnotherControl})

If your menu is not listed in the control collection, add it manually.

MyForm.Controls.AddRange(New Control() {AControl,AnotherControl,
MyMenuControl})


See if this helps....
 
Thank you.

unfortunately Me.Controls.AddRange(MainMenu1)
leads to error:
Error 1 Value of type 'System.Windows.Forms.MainMenu' cannot be converted to
'1-dimensional array of System.Windows.Forms.Control'. ...myform.vb 1284 30
myform

actually there is no prior me.control.addrange but quite a number of
me.controls.add(...)
none for me.mainmenu1
if I use add instead of addrange
Me.Controls.Add(MainMenu1)
I get similar message like using addrange.

btw, I am using visual basic .net 2005 express with latest update. the
project initially upgraded an webICHpstCtrl demo project from prior version
(.net 1?). The main menu was visible both in designer and in run time. I
had ripped out the ole webbrowser component and replaced with an more .net
interface webbrowser.
There was and there still is not separate designer file for myform.



If I create a new project, I will not see any guid component the main code
file but see the in the designer file. that is I end up with 2 partial
classes
 
to use the addrange method, you have to declare an instance.

Controls.AddRange(New MainMenu() {MainMenu1})

you can also use:

Controls.Add(MainMenu1)

--
Thiele Enterprises - The Power Is In Your Hands Now!

--
Thank you.

unfortunately Me.Controls.AddRange(MainMenu1)
leads to error:
Error 1 Value of type 'System.Windows.Forms.MainMenu' cannot be converted to
'1-dimensional array of System.Windows.Forms.Control'. ...myform.vb 1284 30
myform

actually there is no prior me.control.addrange but quite a number of
me.controls.add(...)
none for me.mainmenu1
if I use add instead of addrange
Me.Controls.Add(MainMenu1)
I get similar message like using addrange.

btw, I am using visual basic .net 2005 express with latest update. the
project initially upgraded an webICHpstCtrl demo project from prior version
(.net 1?). The main menu was visible both in designer and in run time. I
had ripped out the ole webbrowser component and replaced with an more .net
interface webbrowser.
There was and there still is not separate designer file for myform.



If I create a new project, I will not see any guid component the main code
file but see the in the designer file. that is I end up with 2 partial
classes
 
If you add more then one control you can use the addrange method, forgot to
add this...

Controls.Addrange({Control1,Control2,etc})

Or you can add them one at a time.

Controls.Add(Control1)
Controls.Add(Control2)
etc...


--
Thiele Enterprises - The Power Is In Your Hands Now!

--
Thank you.

unfortunately Me.Controls.AddRange(MainMenu1)
leads to error:
Error 1 Value of type 'System.Windows.Forms.MainMenu' cannot be converted to
'1-dimensional array of System.Windows.Forms.Control'. ...myform.vb 1284 30
myform

actually there is no prior me.control.addrange but quite a number of
me.controls.add(...)
none for me.mainmenu1
if I use add instead of addrange
Me.Controls.Add(MainMenu1)
I get similar message like using addrange.

btw, I am using visual basic .net 2005 express with latest update. the
project initially upgraded an webICHpstCtrl demo project from prior version
(.net 1?). The main menu was visible both in designer and in run time. I
had ripped out the ole webbrowser component and replaced with an more .net
interface webbrowser.
There was and there still is not separate designer file for myform.



If I create a new project, I will not see any guid component the main code
file but see the in the designer file. that is I end up with 2 partial
classes
 
thank you your patience
however

Controls.Add(MainMenu1)
yields compiler error of
Error 1 Value of type 'System.Windows.Forms.MainMenu' cannot be
converted to 'System.Windows.Forms.Control'.
 
Strange that that happens since the MainMenu is derived from a control....

Have you tried this code...

Me.Controls.AddRange(New Control() {Me.MainMenu1})

Actually am suprised that you don't have MainMenuStrip control.


--
Thiele Enterprises - The Power Is In Your Hands Now!

--
thank you your patience
however

Controls.Add(MainMenu1)
yields compiler error of
Error 1 Value of type 'System.Windows.Forms.MainMenu' cannot be
converted to 'System.Windows.Forms.Control'.
 
yes, same problem, not compatible with controls.



talking about menu strip. I am trying somehow specify meainmenu1 for use
with menustrip.

hopefully, I have better luck there. failing that figure out use of
icomponent.

failing that start from scratch- a long process
 
thank you for continue working with me on this one.

making mainmenu1 to appear in run time turns out to be as simple as adding
menu = mainmenu1
in form load event.

now only if I can make mainmenu1 appear in designer then the problem would
be completely solved
 
hello gs ,

Place a new main menu at the top and set the action handlers of the onew
method handled by the old menu functions. this will solve your Problem.


thank you for continue working with me on this one.

making mainmenu1 to appear in run time turns out to be as simple as adding
menu = mainmenu1
in form load event.

now only if I can make mainmenu1 appear in designer then the problem would
be completely solved
the main menu in the application seemed to disappeared all together until
I
[quoted text clipped - 4 lines]
what can I do. to fix the problem
 
thank you. in visual basic studio express 2005, where can find in designer
the tool for mainmenu?


Or were you taking about a new menustrip under All windows Forms of the
toolbox?

I found another to access the mainmenu1 from designer. Open Document
Outline for the form, expand and locate MainMenu1


From there, I can add /change items in the designer. So this will do for
now
Atheeque via DotNetMonster.com said:
hello gs ,

Place a new main menu at the top and set the action handlers of the onew
method handled by the old menu functions. this will solve your Problem.


thank you for continue working with me on this one.

making mainmenu1 to appear in run time turns out to be as simple as adding
menu = mainmenu1
in form load event.

now only if I can make mainmenu1 appear in designer then the problem would
be completely solved
the main menu in the application seemed to disappeared all together until
I
[quoted text clipped - 4 lines]
what can I do. to fix the problem

--
Atheeque

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200610/1
 
Back
Top