471,089 Members | 1,061 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Creating Menus, Submenus and Menuitems at runtime

Hi Everybody,

This is the first timw I am entering into this Group.

I am developing a VB Project with an MDI form.

I want to display IE Favorites into my application. For this I need to
create Submenus and Menuitems dynamically. It is possible to create
menus using array index. But if I have multiple folders and files in
Favorites then using array index will not work.

Can anyone in this group help me ?

I need source code with an example.

Thanks & Regards
Venkatesh
Jul 17 '05 #1
1 11125
: I want to display IE Favorites into my application. For this I need to
: create Submenus and Menuitems dynamically. It is possible to create
: menus using array index.

Somewhat. In order to create a dynamic menu in VB you must have at least one
member already created at design time. The remaining items are added via the
Load statement, just as with control arrays. This means that to have a menu
that displays sublevels under main items (ie Favorites > Microsoft >
Development and Favorites > Microsoft > Office), you have to have an empty
template under the Favorites and Microsoft items. If the Office folder
contains Office > Word, Office> Excel and Office > Frontpage, then you will
need to have constructed your design time menu with a blank item at this new
sub level. IOW, if the favorites folder contains items n levels deep, your
app has to have blank items n items deep in order to display the menu as it
would appear in IE.

And from what I can see in a quick scan of the MSDN, VB's Control.Add()
method, which provides for adding new controls at runtime without the need
for a template item, is not applicable to menus.
: But if I have multiple folders and files in
: Favorites then using array index will not work.

It is possible to do this (the above) using Windows API, then attaching the
menu to the app, however the VB form will be unaware it has a menu and all
coding for detection of the user's selection would need to be made through
subclassing.

Many VB apps I've seen that require such dynamic menu functionality,
especially for favorites, have resorted to using other controls such as a
treeview displayed in response to a toolbar item click. Not a perfect
solution however.
--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
"Venkatesh" <mv**************@hotmail.com> wrote in message
news:c7**************************@posting.google.c om...
: Hi Everybody,
:
: This is the first timw I am entering into this Group.
:
: I am developing a VB Project with an MDI form.
:
: I want to display IE Favorites into my application. For this I need to
: create Submenus and Menuitems dynamically. It is possible to create
: menus using array index. But if I have multiple folders and files in
: Favorites then using array index will not work.
:
: Can anyone in this group help me ?
:
: I need source code with an example.
:
: Thanks & Regards
: Venkatesh
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Raj Singh Sisodia | last post: by
4 posts views Thread by ssg31415926 | last post: by
5 posts views Thread by Sandy | last post: by
1 post views Thread by paulakeijzers | last post: by
4 posts views Thread by Ray Cassick \(Home\) | last post: by
reply views Thread by ssg31415926 | last post: by
12 posts views Thread by Steve_Black | last post: by

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.