Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 09:16 PM
Venkatesh
Guest
 
Posts: n/a
Default 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
  #2  
Old July 17th, 2005, 09:16 PM
Randy Birch
Guest
 
Posts: n/a
Default Re: Creating Menus, Submenus and Menuitems at runtime

: 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" <mvenkatesh_kumar@hotmail.com> wrote in message
news:c744a4fa.0311102129.17b7f50c@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


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles