|
-
Apr 5th, 2004, 09:55 AM
#1
Thread Starter
Member
Need help with Events
Hello,
Can some one help me? I need to trigger a specific toolbar button Click event when I click menu item.
Thank you.
-
Apr 5th, 2004, 11:17 AM
#2
PowerPoster
Hi,
Same way as you call any objects Click Event. But if you have the necessary button on the toolbar, why are you also referring to it in a Menu? Are you saying that you are not including the toolbar on your form but want to activate the code contained in one of the toolbar buttons?
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Apr 5th, 2004, 11:28 AM
#3
Sleep mode
Incase you're creating this at runtime then you have to do this :
VB Code:
AddHandler ToolBar1.ButtonClick, AddressOf Me.ToolBarCustomHandler
Public Sub ToolBarCustomHandler(ByVal sender As system.Object,
ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs)
Handles ToolBar1.ButtonClick
'Do your stuff here
End Sub
If the toolbar buttonclick event is already created then just do this :
VB Code:
Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Dim btn As String = e.Button.Text
Select Case btn
Case "Add"
MsgBox("add button was clicked")
Case "Edit"
MsgBox("edit button was clicked")
Case "Search"
MsgBox("search button was clicked")
End Select
End Sub
'From your menuitem , you can call the edit button like this :
Me.ToolBar1_ButtonClick(Me, New ToolBarButtonClickEventArgs(New ToolBarButton("Edit")))
-
Apr 5th, 2004, 11:53 AM
#4
Thread Starter
Member
Thank you very much it works great
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|