Creating menus at run-time 
Author Message
 Creating menus at run-time

Hi all,

Does anybody know how I can create menus (and SUBMENUS!) at run-time. I
made a small app to show what I want to do. It is just an empty form
with a menu created with the menu editor. I created a MainMenu item
control array and a SubMenu item control array:

Menu name     Caption     Index
-------------------------------
MainMenu      MainMenu    999
...SubMenu    Submenu     999

Here's the Form_Load code:

Private Sub Form_Load()

    Dim i, j

    For i = 0 To 5
        Load MainMenu(i)
        MainMenu(i).Caption = i
        For j = 0 To 5
            Load SubMenu(i * 10 + j)
            SubMenu(i * 10 + j).Caption = i & ", " & j
        Next j
    Next i

    MainMenu(999).Visible = False

End Sub

When I run this code, all submenu items are added to the first MainMenu
item (999) which I created at design-time.

Thanks,

Jeroen



Tue, 12 Sep 2000 03:00:00 GMT  
 Creating menus at run-time

Hi all,

Does anybody know how I can create menus (and SUBMENUS!) at run-time. I
made a small app to show what I want to do. It is just an empty form
with a menu created with the menu editor. I created a MainMenu item
control array and a SubMenu item control array:

Menu name     Caption     Index
-------------------------------
MainMenu      MainMenu    999
...SubMenu    Submenu     999

Here's the Form_Load code:

Private Sub Form_Load()

    Dim i, j

    For i = 0 To 5
        Load MainMenu(i)
        MainMenu(i).Caption = i
        For j = 0 To 5
            Load SubMenu(i * 10 + j)
            SubMenu(i * 10 + j).Caption = i & ", " & j
        Next j
    Next i

    MainMenu(999).Visible = False

End Sub

When I run this code, all submenu items are added to the first MainMenu
item (999) which I created at design-time.

Thanks,

Jeroen



Tue, 12 Sep 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Creating Menus At Run-Time

2. Creating Menus At Run-Time

3. Creating menus at run-time

4. Creating menus at Run Time

5. How to create menus at run-time.

6. Creating menus at run-time

7. Creating menus at run-time

8. Creating Menus in Runtime

9. Creating Menu at Runtime (VB5.0)

10. How to creating menu at runtime using vb5

11. Creating Menu at Runtime

12. Creating Menus at runtime

 

 
Powered by phpBB® Forum Software