Creating a menu and attaching code .
(Taken from VB-Tutorial CDs ..)
Refer Design a Menu Bar and Create a Menu as per the format given
And , Creating Tool Bar with Click Event
Select Tools--> Menu Editor and create menus as per given below :
(A)Program Design :
(B) Property(Controls Used) :
You can watch this Video to know about adding Menu Bar into our form.
(C) Attaching Code to the Object :
(Taken from VB-Tutorial CDs ..)
Refer Design a Menu Bar and Create a Menu as per the format given
And , Creating Tool Bar with Click Event
Select Tools--> Menu Editor and create menus as per given below :
(A)Program Design :
(B) Property(Controls Used) :
- File & Exit are the main menus
- Two sub menus of File are Colors & Size
- The sub menu of Color is Set Color
- The sub menu of Set Color is White , Red & Blue
You can watch this Video to know about adding Menu Bar into our form.
(C) Attaching Code to the Object :
Private Sub Form_Load() mnuwhite.Enabled = False mnuwhite.Checked = True End Sub |
Private Sub mnublue_Click() Form1.BackColor = vbBlue mnuwhite.Enabled = True mnuwhite.Checked = False mnured.Enabled = True mnured.Checked = False mnublue.Enabled = False mnublue.Checked = True End Sub |
Private Sub mnuexit_Click() End End Sub |
Private Sub mnularge_Click() Form1.WindowState = 2 End Sub |
Private Sub mnured_Click() Form1.BackColor = vbRed mnuwhite.Enabled = True mnuwhite.Checked = False mnured.Enabled = False mnured.Checked = True mnublue.Enabled = True mnublue.Checked = False End Sub |
Private Sub mnusmall_Click() Form1.WindowState = 0 End Sub |
Private Sub mnuwhite_Click() Form1.BackColor = vbWhite mnuwhite.Enabled = False mnuwhite.Checked = True mnured.Enabled = True mnured.Checked = False mnublue.Enabled = True mnublue.Checked = False End Sub |
(D) Errors :
If found any errors while running your VB program, or want to put your comment about any program , please click Comment section , to post.
====================================================================
No comments:
Post a Comment