Tuesday, June 5, 2018

Menu design and its related feature in VB6.0 Easy tech Tips

Menu design and its related feature in VB6.0 Easy tech Tips

Whenever you want to implement your application through VB6.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 it.

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 items 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.
Create Main Items:
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.
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.

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
In this way you can learn about menu design and its related feature in Visual Basic 6.0 easy tips 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