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_ButtonC lick(ByVal sender As System.Object, ByVal e As
System.Windows. Forms.ToolBarBu ttonClickEventA rgs) Handles
tbUsers.ButtonC lick
Select Case e.Button.Text
Case "WhateverTheTex t"
....
....
....
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
ToolBarButtonCl ickEventArgs"
ie..
Public Sub Button
tbUsers_ButtonC lick(Me, e.Button.Text=" WhateverTheText ")
End Sub
Is there some other special way I have to specify what button event I want
fired?
Thanks!! 4 3290
* "Brian Mitchell" <Ma********@hot mail.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_ButtonC lick(ByVal sender As System.Object, ByVal e As System.Windows. Forms.ToolBarBu ttonClickEventA rgs) Handles tbUsers.ButtonC lick Select Case e.Button.Text
Case "WhateverTheTex t" .... .... ....
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 ToolBarButtonCl ickEventArgs"
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/>
You cannot raise an event outside of the class it was declared in.
"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:OM******** *****@tk2msftng p13.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_ButtonC lick(ByVal sender As System.Object, ByVal e As System.Windows. Forms.ToolBarBu ttonClickEventA rgs) Handles tbUsers.ButtonC lick Select Case e.Button.Text
Case "WhateverTheTex t" .... .... ....
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 ToolBarButtonCl ickEventArgs"
ie..
Public Sub Button tbUsers_ButtonC lick(Me, e.Button.Text=" WhateverTheText ") End Sub
Is there some other special way I have to specify what button event I want fired?
Thanks!!
The problem is that you're trying to pass in a boolean expression
(e.Button.Text= "WhateverTheTex t" does not set anything in this context, it
is simply true or false) where you should be passing a
ToolBarButtonCl ickEventArgs object. Try the following...
Dim e As ToolBarButtonCl ickEventArgs
e.Button = tbUsers.Buttons (index of button to click)
tbUsers_ButtonC lick(Me, e)
"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:OM******** *****@tk2msftng p13.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_ButtonC lick(ByVal sender As System.Object, ByVal e As System.Windows. Forms.ToolBarBu ttonClickEventA rgs) Handles tbUsers.ButtonC lick Select Case e.Button.Text
Case "WhateverTheTex t" .... .... ....
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 ToolBarButtonCl ickEventArgs"
ie..
Public Sub Button tbUsers_ButtonC lick(Me, e.Button.Text=" WhateverTheText ") End Sub
Is there some other special way I have to specify what button event I want fired?
Thanks!!
Thank You all for the suggestions.
"Scott" <sc*****@yahoo. com> wrote in message
news:uV******** *****@tk2msftng p13.phx.gbl... The problem is that you're trying to pass in a boolean expression (e.Button.Text= "WhateverTheTex t" does not set anything in this context, it is simply true or false) where you should be passing a ToolBarButtonCl ickEventArgs object. Try the following...
Dim e As ToolBarButtonCl ickEventArgs e.Button = tbUsers.Buttons (index of button to click) tbUsers_ButtonC lick(Me, e)
"Brian Mitchell" <Ma********@hot mail.com> wrote in message news:OM******** *****@tk2msftng p13.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_ButtonC lick(ByVal sender As System.Object, ByVal e
As System.Windows. Forms.ToolBarBu ttonClickEventA rgs) Handles tbUsers.ButtonC lick Select Case e.Button.Text
Case "WhateverTheTex t" .... .... ....
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 ToolBarButtonCl ickEventArgs"
ie..
Public Sub Button tbUsers_ButtonC lick(Me, e.Button.Text=" WhateverTheText ") End Sub
Is there some other special way I have to specify what button event I
want fired?
Thanks!!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 show me some sample code for the Toolbar's onclick event?
Thanks in advance.
|
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 advance.
Private Sub Toolbar1_ButtonClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Toolbar1.ButtonClick
|
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 few operations, toolbar on MDI from doesn't catch
"Click" event.
But it catch all other events like mouse leave etc.
|
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 problem is that button
doesnt exposes attribute collection. I can attach javascript to whole
toolbar but 1. it would defeat the purpose of only attaching client scripts
to some buttons 2. i would have no means of identifying which button was...
|
by: Mark Goldin |
last post by:
I have a toolbar on my form.
How do I know what button was clicked?
| |
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.
|
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 button.index passed.
for each "mdi child form", i have defined the module:
sub Action(byval buttonIndex as integer)
case of buttonIndex
take the actions
|
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.
Essentially, my (trimmed-down) code contains this:
Public Class ModalDialog
Protected WithEvents btnYes As New Button
|
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 we have a standard toolbar that is at the top of the
form window. It contains about 8 buttons that use images from an imagelist.
Sometimes we hide buttons thru the code.
When a button is hidden, i assumed that it wasn't clickable. It appears
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |