Tuesday, June 5, 2018

Create Menu Editor with Menu Design in VB6.0 Tech Tips

Create Menu Editor with Menu Design in VB6.0 Tech Tips

Whenever you want to implement your application through Visual Basic 6.0, Menu provides an easy way to connect another form or other activity with all controls. If you want to proceed to know about its working process, come and learn about how to Create Menu Editor with Menu Design in VB6.0.

Here we will discuss about 2 processes.
  1. Add Menu Items with Shortcut Key
  2. Enable or disable items during run time
1. Add Menu Items with Shortcut Key:
First, Open project and find “Menu Editor” icon from Visual basic Toolbox. Remember this icon will show in enable view, when project is in design mode.


First go to this option and click on it. When you click on this icon, it will show a Box with “Menu Editor” Name. For open it, you can also try to press shortcut key (Ctrl+E) from keyboard. This box contains many controls. Know something about its control as follow.
Caption: Show the Item's Name during run time.
Name: This will use to define every items name, which will use to write code with its name event.
Shortcut: If you want to provide any shortcut key perform through keyboard on that particular item, then select any key option from this combo box.

How To Create Menu Editor in Visual Basic 6.0?


Create Main Items:
For Creating Menu's Main Items, you have to follow the steps or points (1),(2),(3),(4),(5) describe as following image.
Menu itmes design process
Menu design process
Note: Consider about that when you input items name in “Name” textbox, do not use ‘SPACE’ or ‘- or ‘,’ or ‘.’ . Use ‘_’ except this.


How To add Sub-Menu in VB6.0?


Create Sub-Items:
You can add items according to requirement. It is not necessary to input same name as mention above. If you want to give any shortcut key then follow the image bellow.
For Assign sub-menu inside Main, you have to click onSub-menu arrow this button. This will show items in  this format (“.......” + Item name)
eg.:......Form2
Shortcut Key selection
Shortcut Key Select
Code Process:
After doing all these process. Click on “OK” button. Now write code in its items events. Suppose we add 2 Form to Project. First name is “Form2” and second is “Form3”.

Now, write code in Item “Open_form2”.

Private Sub Open_form2_Click()

     Form2.Show , Form1
     Form2.BackColor = &HC0C0FF
     Form2.Height = 4000
     Form2.Width = 5000

End Sub

In this code we will open Form2 and change its Height, width and Background color. Now, write code in Item “Open_form3”.

Private Sub Open_form3_Click()

     Form3.Show , Form1
     Form3.BackColor = &HC0FFC0
     Form3.Height = 4500
     Form3.Width = 5500

End Sub

This code will open Form3 and also change its Height width and Background color. Now, write code in Item “F_Exit”.

Private Sub F_Exit _Click()
 
     End

End Sub

This code will close application.


There is output of this process, which will show the main work during run time.
Run time Output of Menu
If you want to main menu’s first character will be in underscore format such as: Form Details. You have to assign “&” operator. Before assign Caption such as: &Form Details.

Note: The Underscore process will not work on sub- items. You can apply it on main item such as above describe.

How TO Enable or Disable Menu Items in VB6.0?


2. Enable or disable Menu items during run time:
If you want to enable or disable process during run time, you have to write code for it.

Suppose we drag 2 command buttons Command1 and Command2 with Caption “Disable” and “Enable”. Just write code in it.


For Disable Items:

Private Sub Command1_Click()

     Open_form2.Enabled = False
     Open_form3.Enabled = False

End Sub


For Enable Items:

Private Sub Command2_Click()

     Open_form2.Enabled = True
     Open_form3.Enabled = True

End Sub

There is following output.
Enable or disable process

Above given animated image shows the process of Menu in VB6.0. In this way you can learn about Create Menu Editor with Menu Design in VB6.0 with SKOTechlearn.

3 comments:

  1. Hi, Nice collection i appreciate your work...
    keep sharing such a good stuff and keep up the good work
    thank you
    check out my collection here: Love Status

    ReplyDelete