Expand Menu at startup

rayala25

New member
Joined
Sep 21, 2005
Messages
3
Programming Experience
1-3
Hello,

I have a form with a MainMenu on it, I would like to expand automatically this menu when form loads, how can I do this, or how can I programatically expand menus?

Thanks in advance!


------------------ SOLVED

I solved this by using SendKeys.Send on Form Paint Event...

PrivateSub FormaMenu_Paint(ByVal sender AsObject, ByVal e As System.Windows.Forms.PaintEventArgs) HandlesMyBase.Paint
SendKeys.Send("%F")
EndSub


%F Means to send "ALT+F" keys at a time, "% = ALT", "F" is the shortcut for the menu item i want to expand.

I hope this helps to others.

Regards.
 
Last edited:
Isn't that going to expand your menu EVERY time it gets painted? Wouldn't you be better to do it in the form's Activated event handler and use a Boolean variable to test whether this is the first activation or not.
 
you're right

jmcilhinney said:
Isn't that going to expand your menu EVERY time it gets painted? Wouldn't you be better to do it in the form's Activated event handler and use a Boolean variable to test whether this is the first activation or not.

Yes, you are right, i changed it to Activated event. but what i see now is that the default cursor is changed by the sandglass, anyone knows why is happening this?

Thanks.
 
Back
Top