Hello,
I have a form with several buttons.
If a user clicks on one I want it to call the Click() event of another
button.
In VB6 this is very easy but they've changed it in .NET.
Can't we just do: call mybutton_click() anymore?
Thanks,
Adam Honek 14 7502
Adam Honek wrote: Hello,
I have a form with several buttons.
If a user clicks on one I want it to call the Click() event of another button.
In VB6 this is very easy but they've changed it in .NET.
Can't we just do: call mybutton_click() anymore?
Thanks, Adam Honek
have you tried using "Handles Button2.Click"
--
Daniel
MCSE, MCP+I, MCP in Windows 2000/NT
--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Yes but it won't work.
Right now I have something like this:
If e.KeyCode = Keys.Enter Then
handles btnX.Click()
End If
Adam
"Daniel" <da****@madridmadridsoleado.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Adam Honek wrote: Hello,
I have a form with several buttons.
If a user clicks on one I want it to call the Click() event of another button.
In VB6 this is very easy but they've changed it in .NET.
Can't we just do: call mybutton_click() anymore?
Thanks, Adam Honek
have you tried using "Handles Button2.Click"
--
Daniel MCSE, MCP+I, MCP in Windows 2000/NT
-------------------------------------- remove the 2nd madrid from my mail address to contact me.
Adam,
myButton.PerformClick might be what you need.
Kerry Moorman
"Adam Honek" wrote: Hello,
I have a form with several buttons.
If a user clicks on one I want it to call the Click() event of another button.
In VB6 this is very easy but they've changed it in .NET.
Can't we just do: call mybutton_click() anymore?
Thanks, Adam Honek
Adam Honek wrote: Can't we just do: call mybutton_click() anymore?
You can (though you'll have to pass the appropriate parameters), but a
better way is to call the button's PerformClick method.
--
(O)enone
The way I would do this is write a freestanding subroutine to do what I
wanted, then call it from both button click subroutines at the appropriate
time.
Bobbo
Bingo, exactly what I need.
Geez they've sure changed things round.
Thanks,
Adam
"Kerry Moorman" <Ke**********@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com... Adam,
myButton.PerformClick might be what you need.
Kerry Moorman
"Adam Honek" wrote:
Hello,
I have a form with several buttons.
If a user clicks on one I want it to call the Click() event of another button.
In VB6 this is very easy but they've changed it in .NET.
Can't we just do: call mybutton_click() anymore?
Thanks, Adam Honek
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb: I have a form with several buttons.
If a user clicks on one I want it to call the Click() event of another button.
In VB6 this is very easy but they've changed it in .NET.
Can't we just do: call mybutton_click() anymore?
If the button is visible and enabled, you can call its 'PerformClick'
method. Alterantively you can take the code from the event handler and put
it into a separate procedure. This procedure can be called from within the
event handler and other procedures. If you really want to call the button's
'Click' event handler for some reason, you can pass 'EventArgs.Empty' in the
'e' parameter.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Adam,
This one does it forever.
button_Click(nohing,nothing)
I hope this helps,
Cor
Cor,
"Cor Ligthert" <no************@planet.nl> schrieb: This one does it forever.
button_Click(nohing,nothing)
Mhm... I would not use this one, because the event contract will be broken
(no sender and event arguments are sent).
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Herfried, Mhm... I would not use this one, because the event contract will be broken (no sender and event arguments are sent).
Ignoring the nohing (typo). I thought today, let me do it very clean. I
used the performclick. Because of your message in this thread, do I now know
why that did not go.
Maybe you understand now as well why I made this message, it was to help the
OP not to have the same problem as me today.
:-)
By the way when what you tell is a problem than a simple
\\\
If sender is Nothing then 'do something
or in VB2005
If Not sender IsNot Nothing then 'do something
///
Does overcome that problem
:-)
Cor
Cor,
"Cor Ligthert" <no************@planet.nl> schrieb: Mhm... I would not use this one, because the event contract will be broken (no sender and event arguments are sent). Ignoring the nohing (typo). I thought today, let me do it very clean. I used the performclick. Because of your message in this thread, do I now know why that did not go.
'PerformClick' actually works under certain circumstances.
Maybe you understand now as well why I made this message, it was to help the OP not to have the same problem as me today.
Sorry, I cannot follow you...
By the way when what you tell is a problem than a simple \\\ If sender is Nothing then 'do something or in VB2005 If Not sender IsNot Nothing then 'do something ///
I prefer 'If Not sender Is Nothing Then...' or 'If sender IsNot Nothing
Then...' ;-). However, I'd try to avoid this situation.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Herfried, Maybe you understand now as well why I made this message, it was to help the OP not to have the same problem as me today.
I had this problem today because as what you had described in this thread.
I tried to help the OP by giving the (nothing nothing) code, so that (let us
say), have the same problems, knows how to fix that.
By the way. The performclick is AFAIK only creating a
callEventFunction(nothing, nothing).
Cor
sht so that (let us say), have the same problems, knows how to fix that.
so that (let us say) when he has the same problems, knows how to fix that
Cor
Cor,
"Cor Ligthert" <no************@planet.nl> schrieb: By the way. The performclick is AFAIK only creating a callEventFunction(nothing, nothing).
No, it isn't. It's creating a '(<reference to sender>, EventArgs.Empty)'!
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marco Maroni |
last post by:
I have a form with two or more INPUT TYPE (image, submit, button) objects,
how can I force the ENTER event to act on a specific object and not to...
|
by: Arulraja |
last post by:
Hello,
I have created 2 custom server controls, The parent custom control
contains multiple child custom controls. The Child control has a...
|
by: JezB |
last post by:
I have a button which implicitly posts-back before firing the event that I
have attached to that button. Within that event code I modify the...
|
by: Amirallia |
last post by:
Hello
I want to force the Page.IsPostBack to false when I click an
"asp:button"
Is it possible ?
--
Ceci est une signature automatique de...
|
by: Keith H |
last post by:
I'm looking for a way to force the user to re-authenticate with their Windows
username/password/domain after clicking the submit button on an...
|
by: Jordi Rico |
last post by:
Hi,
I'd like to know if there's any way to force a DateTimePicker to
dropdown, something like PerformClick() in a button...
I'd like to force this...
|
by: BudhramM |
last post by:
Hi,
I have a webpage that has 2 ASP.Net buttons as well as some other
controls. The controls are split up into two, there is a set of Combo...
|
by: Paul Gorodyansky |
last post by:
Hi,
Ran into the following problem while trying to have a code to
attach a Virtual Keyboard to any user's form:
User clicks a button and my...
|
by: anudu |
last post by:
hi,
im dveloping a web system using vs 2008. in my page i have a ajax page method wich is called by javascript function . in onsuceeded method i...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |