Search Tools Links Login

Add Menu Subitems at Runtime


This simple program adds menu items or subitems at runtime without any api calls.

Put a label on the form, in the menu editor add a menu item call it FileMenu with an index of 0, then add a subitem call it FileMenu1 with an index of 0.

To add new menus add them as FileMenu(**)
To add subitems add them as FileMenu1(**)

Change the names to suit

Original Author: docsery

Private Sub FileMenu1_Click(Index As Integer)
Select Case Index
Case Index
Label1.Caption = Index
End Select
End Sub

Private Sub Form_Load()
Dim x As Integer
For x = 1 To 4
    Load FileMenu1(x)
    FileMenu1(x).Caption = "Menu " & x + 1
    FileMenu1(x).Visible = True
Next x
End Sub

About this post

Posted: 2020-10-07
By: vb6boy
Viewed: 393 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.