Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Creating a ToolBar in Visual Basic.Net

Author: DevASP
Download Source Code : 449_CreateToolBar.zip

In this article I will try to explain you, how you can create a toolbar and perform action on its button click event using Visual Basic.Net

Create a new application in VB.Net. Convert the form to mdi from by setting its property IsMdiContainer to true. Now drag the image list and create collection and add items in the list to show them in the Toolbar. Drag the toolbar control and set appearance to flat. Select the already created image list in the image list property of the toolbar. 

Now you have to cerate the button for the toolbar, Click the button property and add the buttons, set the properties of the button image index select the index of image which is selected in imagelist and style of the button like push button or separator. Set divider property to false. 

Now double click on toolbar and write the following code on ToolBar1_ButtonClick event:

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick

Select Case e.Button.ImageIndex

Case 0

   MsgBox("Copy icon", MsgBoxStyle.Information, "Tool Bar")

Case 1

   MsgBox("Cut icon", MsgBoxStyle.Information, "Tool Bar")

Case 2

   MsgBox("Paste icon", MsgBoxStyle.Information, "Tool Bar")

Case 3

   MsgBox("Zoom in icon", MsgBoxStyle.Information, "Tool Bar")

Case 4

   MsgBox("Zoom out icon", MsgBoxStyle.Information, "Tool Bar")

Case 5

   MsgBox("Calc icon", MsgBoxStyle.Information, "Tool Bar")

Case 6

   MsgBox("Word icon", MsgBoxStyle.Information, "Tool Bar")

Case 7

   MsgBox("Chat icon", MsgBoxStyle.Information, "Tool Bar")

Case 8

   MsgBox("Lane icon", MsgBoxStyle.Information, "Tool Bar")

Case 9

   MsgBox("Resize icon", MsgBoxStyle.Information, "Tool Bar")

Case 10

   MsgBox("Fit to Size icon", MsgBoxStyle.Information, "Tool Bar")

Case 11

   MsgBox("Rotate icon", MsgBoxStyle.Information, "Tool Bar")

Case 12

   MsgBox("Database icon", MsgBoxStyle.Information, "Tool Bar")

Case 13

   MsgBox("Users icon", MsgBoxStyle.Information, "Tool Bar")

Case 14

   MsgBox("Logoff icon", MsgBoxStyle.Information, "Tool Bar")

Case 15

   MsgBox("About icon", MsgBoxStyle.Information, "Tool Bar")

End Select

End Sub

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to Create Dependent ComboBox in VB.Net

Disclaimer - Privacy
© 2002-2017 DevASP.net