473,379 Members | 1,184 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Firing Toolbar ButtonClick Event manually

How do you fire a toolbar ButtonClick event manually (for a specified
button)?

I have a toolbar with 4 buttons on it and I want to fire one of the button
events when the user clicks a different button on the form.

The event for the toolbar looks like this...

Private Sub tbUsers_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
tbUsers.ButtonClick
Select Case e.Button.Text

Case "WhateverTheText"
....
....
....

End Select

End Sub
When I try to fire the event manually and pass a value for e.button.text, I
get an error "Value 'Boolean' cannot be converted to
ToolBarButtonClickEventArgs"

ie..

Public Sub Button
tbUsers_ButtonClick(Me, e.Button.Text="WhateverTheText")
End Sub
Is there some other special way I have to specify what button event I want
fired?

Thanks!!
Nov 20 '05 #1
4 3271
* "Brian Mitchell" <Ma********@hotmail.com> scripsit:
I have a toolbar with 4 buttons on it and I want to fire one of the button
events when the user clicks a different button on the form.

The event for the toolbar looks like this...

Private Sub tbUsers_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
tbUsers.ButtonClick
Select Case e.Button.Text

Case "WhateverTheText"
....
....
....

End Select

End Sub
When I try to fire the event manually and pass a value for e.button.text, I
get an error "Value 'Boolean' cannot be converted to
ToolBarButtonClickEventArgs"


Why not place the code which should be executed on button click in a
separate procedure and call this procedure directly?

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #2
You cannot raise an event outside of the class it was declared in.
"Brian Mitchell" <Ma********@hotmail.com> wrote in message
news:OM*************@tk2msftngp13.phx.gbl...
How do you fire a toolbar ButtonClick event manually (for a specified
button)?

I have a toolbar with 4 buttons on it and I want to fire one of the button
events when the user clicks a different button on the form.

The event for the toolbar looks like this...

Private Sub tbUsers_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
tbUsers.ButtonClick
Select Case e.Button.Text

Case "WhateverTheText"
....
....
....

End Select

End Sub
When I try to fire the event manually and pass a value for e.button.text, I get an error "Value 'Boolean' cannot be converted to
ToolBarButtonClickEventArgs"

ie..

Public Sub Button
tbUsers_ButtonClick(Me, e.Button.Text="WhateverTheText")
End Sub
Is there some other special way I have to specify what button event I want
fired?

Thanks!!

Nov 20 '05 #3
The problem is that you're trying to pass in a boolean expression
(e.Button.Text="WhateverTheText" does not set anything in this context, it
is simply true or false) where you should be passing a
ToolBarButtonClickEventArgs object. Try the following...

Dim e As ToolBarButtonClickEventArgs
e.Button = tbUsers.Buttons(index of button to click)
tbUsers_ButtonClick(Me, e)
"Brian Mitchell" <Ma********@hotmail.com> wrote in message
news:OM*************@tk2msftngp13.phx.gbl...
How do you fire a toolbar ButtonClick event manually (for a specified
button)?

I have a toolbar with 4 buttons on it and I want to fire one of the button
events when the user clicks a different button on the form.

The event for the toolbar looks like this...

Private Sub tbUsers_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
tbUsers.ButtonClick
Select Case e.Button.Text

Case "WhateverTheText"
....
....
....

End Select

End Sub
When I try to fire the event manually and pass a value for e.button.text, I get an error "Value 'Boolean' cannot be converted to
ToolBarButtonClickEventArgs"

ie..

Public Sub Button
tbUsers_ButtonClick(Me, e.Button.Text="WhateverTheText")
End Sub
Is there some other special way I have to specify what button event I want
fired?

Thanks!!

Nov 20 '05 #4
Thank You all for the suggestions.

"Scott" <sc*****@yahoo.com> wrote in message
news:uV*************@tk2msftngp13.phx.gbl...
The problem is that you're trying to pass in a boolean expression
(e.Button.Text="WhateverTheText" does not set anything in this context, it
is simply true or false) where you should be passing a
ToolBarButtonClickEventArgs object. Try the following...

Dim e As ToolBarButtonClickEventArgs
e.Button = tbUsers.Buttons(index of button to click)
tbUsers_ButtonClick(Me, e)
"Brian Mitchell" <Ma********@hotmail.com> wrote in message
news:OM*************@tk2msftngp13.phx.gbl...
How do you fire a toolbar ButtonClick event manually (for a specified
button)?

I have a toolbar with 4 buttons on it and I want to fire one of the button events when the user clicks a different button on the form.

The event for the toolbar looks like this...

Private Sub tbUsers_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
tbUsers.ButtonClick
Select Case e.Button.Text

Case "WhateverTheText"
....
....
....

End Select

End Sub
When I try to fire the event manually and pass a value for e.button.text,
I
get an error "Value 'Boolean' cannot be converted to
ToolBarButtonClickEventArgs"

ie..

Public Sub Button
tbUsers_ButtonClick(Me, e.Button.Text="WhateverTheText")
End Sub
Is there some other special way I have to specify what button event I

want fired?

Thanks!!


Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim Mitchell | last post by:
I added a toolbar and then added two images that the user can not click on. I double click on the toolbar in design mode and it does not seem to create any kind of OnClick Event. Can someone...
0
by: Jim Mitchell | last post by:
I am using the following code to trap the onclick event for the Toolbar Webcontrol. The problem is that I have no way to tell which button on the toolbar was clicked. Any ideas? Thanks in...
2
by: Sakharam Phapale | last post by:
Hi All, I am working on a project, where maximum operations carried out on Files and multi-dimensional arrays. Since array data is huge application takes too much memory. My problem is, after...
2
by: Ashish | last post by:
Hello, I am sick and tired of ochestrating server and client side scripts. Basically I am using toolbar from IE web controls and want to attach javascript to one of the buttons' click event. The...
8
by: Mark Goldin | last post by:
I have a toolbar on my form. How do I know what button was clicked?
4
by: Bill English | last post by:
How do I assign a method to the click event of a specific toolbar button? When I look under ToolbarButton1 events, all I see is disposed.
3
by: Smiles | last post by:
Hi there. Thanks for help in advance. I have an mdi form, with a toolbar. When i click on the toolbar button, i want to call the sub of "active mdi child" form's "Action" module, with the...
1
by: Don Q. | last post by:
Hi, I'm writing a class in VB that will (once I get it working) be rolled up into a DLL for use in all our web applications. However I'm running into problems with button events not firing. ...
6
by: =?Utf-8?B?L2Rldi9udWxs?= | last post by:
Hello, i am using visual studio 2003 enterprise architect version. I am making apps for the .Net framework 1.1. While testing an interface, i discovered something strange. In this application...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.