Solved

Menu at run-time

Posted on 1999-01-12
5
132 Views
Last Modified: 2010-05-03
Hi,

I use VB6.
How can i add new topics to menu at runtime?
How free am i modifing menu at runtime?

-Peter
0
Comment
Question by:hpet
5 Comments
 
LVL 3

Accepted Solution

by:
jjbyers earned 50 total points
ID: 1455719
Your very free at run-time to add menu items.

Look at the SDINote.vbp sample app that comes with VB5.

Hope this helps.
0
 

Expert Comment

by:mawe
ID: 1455720
Create a control array e.g. mnuFileItem(0), mnuFileItem(1) and so on at design time. Then set the visible property to False for the blank menu controls, and set the visible property to True once you've added text in a control.

0
 
LVL 3

Expert Comment

by:jjmartin
ID: 1455721
Here is an example of some menu items being added at run time.  This is based off of a table with some names that are inserted into the menu.  Hope this helps.

rstNames is the recordset that contains the names.
mnuFileOpenName(Name_Idx) is the menu item array.  During design time, set the index property to zero.

Do Until rstNames.EOF

      If Name_Idx > 0 Then
          Load Me.mnuFileOpenName(Name_Idx)
'Here we are loading the next instance of the menu item, we only load if it is greater than zero because the menu item with index zero was created at design time.
      End If

        Me.mnuFileOpenName(Name_Idx).Caption = rstNames!Name 'set the caption for the new menu item
      Me.mnuFileOpenName(Name_Idx).visible = true 'showing the new menu item
        Name_Idx = Name_Idx + 1 'increment the load index
        rstNames.MoveNext 'move to the next record

    Loop
0
 
LVL 14

Expert Comment

by:waty
ID: 1455722
0
 
LVL 1

Author Comment

by:hpet
ID: 1455723
Sorry for delay...

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now