?
Solved

Menu at run-time

Posted on 1999-01-12
5
Medium Priority
?
149 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Accepted Solution

by:
jjbyers earned 200 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Suggested Courses

650 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