How to create a Tool Bar in VB and make a Click Event For the created Buttons.
(Taken from VB-Tutorial CDs ..)
Select, Project--> Components.
Then a Dialog Box will appear and select Microsoft Windows Common Controls 6.0 and Click OK, as given below :
Then , we can see that ,some tools are added to the ToolBar , as shown below :
Note the Actual ToolBar and ToolBar after adding the Control:
Add 2 Controls called ToolBar and Image List to our Form (The added Controls will not visible in the form while running ) , as given below :
==================================================================================================================================================================
Changing Properties to the 2 added controls :
(A)Right Click the second Control Image List to get the property page as shown below :
It has 3 options as General, Image and Color
- Select the General Tab ...From there , change set the size as 32X32 and Click ok.
- Next select the Image Tab from the Property Page of ToolBar ..It is shown after the belw given Image.
- General Tab :
Image Tab :
Next select the Image Tab from the Property Page of ToolBar .And select Insert Picture to insert pictures .If we insert 4 pictures , then the Image Count will be 4 .
(B)Right Click the first Control ToolBar to get the property page as shown below :
It has 3 options as General, Buttons and Picture
- Select the General Tab ...From there , change the third option Image List from None to Image List1 , and Click OK.
- Next select the Buttons option from the Property Page of ToolBar .It is shown after the belw given Image.
- General Tab :
- Button Tab :
Click Insert Button ,Give a Caption for the inserted picture ..We can insert any number of pictures as we like.(Note that , the Index of each inserted image will be 1,2,3....etc.upto the selected image)
Run the Project :
We can see a ToolBar in the Form , and with 4 Buttons.
But , There is only one click event for all this 4 Buttons.
Each Buttons has a property named Index
Using this Index Property , we can write Code for each Buttons .
(That will follow by another Program..)
Refer Program Using Menu Bar also.
(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