473,554 Members | 2,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Force button event?

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
Nov 21 '05 #1
14 7583
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.
Nov 21 '05 #2
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****@madridm adridsoleado.co m> wrote in message
news:%2******** ********@TK2MSF TNGP14.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.

Nov 21 '05 #3
Adam,

myButton.Perfor mClick 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

Nov 21 '05 #4
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
Nov 21 '05 #5
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
Nov 21 '05 #6
Bingo, exactly what I need.

Geez they've sure changed things round.

Thanks,
Adam

"Kerry Moorman" <Ke**********@d iscussions.micr osoft.com> wrote in message
news:E6******** *************** ***********@mic rosoft.com...
Adam,

myButton.Perfor mClick 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

Nov 21 '05 #7
"Adam Honek" <Ad*******@Webm aster2001.frees erve.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.Empt y' in the
'e' parameter.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #8
Adam,

This one does it forever.

button_Click(no hing,nothing)

I hope this helps,

Cor
Nov 21 '05 #9
Cor,

"Cor Ligthert" <no************ @planet.nl> schrieb:
This one does it forever.

button_Click(no hing,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/>

Nov 21 '05 #10

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

Similar topics

1
2757
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 the first ? -- Marco Maroni
3
7710
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 button on it. If I Click the button control, it calls the Parent controls CreateChildControls() method before calling the child control's button click event. Because of this behaviour, I am not...
1
1725
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 controls collection on the page so I want to force another postback, how do I do this from my code-behind module ? (c# preferably).
8
9099
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 MesNews. Site : http://www.mesnews.net
8
16487
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 ASP.NET page. This is for an internal application. Does anyone know if/how this can be done?
4
4462
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 dropdown from the click event in other button apart from the datetimepicker. Thanks!
1
17281
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 boxes and then there is a single text input box. The controls are seperated by DIV's to create a TABView. So when clicking on the 1st tab will show the combo boxes and a button, the second tab will show...
51
4343
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 JavaScript changes outerHTML of say <textarea - adding things like ONCLICK='saveCaret(this)' etc. and it also tries to save any text that user could've entered before the button press.
4
5994
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 want to force the save button on my page to be called and do the serverside finction in code behind "btnSave_Click(object sender, EventArgs e)" method. I am calling this pagemethod function in...
0
7808
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8047
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7570
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...
0
7893
tracyyun
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...
0
6156
agi2029
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...
1
5441
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3556
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2022
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1141
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.