473,394 Members | 1,781 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,394 software developers and data experts.

invok a button click

Hi,
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know how to use it ion this
case.
Thanks

Nov 20 '05 #1
4 31514
There are a number of ways to do this.
Most likely the most straight forward way would be to have a subroutine
which performs the desired code you wish to run. Then, you can call this
subroutine either by calling it from the button event or from your other
code.
You dont want to raise the button event, you want to run the code which the
button causes.

Regards

"touf" <to******@hotmail.com> wrote in message
news:Oz*************@tk2msftngp13.phx.gbl...
Hi,
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know how to use it ion this
case.
Thanks

Nov 20 '05 #2
Hi Touf,
For the most part I've gotta agree with Jerry. Unless you are testing your
button routine what he recommended is ideal. However since you asked I'll go
ahead and tell ya:
If I wanted to click a menu item from a button I'd just put the following
code in a button
mnuOpenGame_Click(sender, e)
so to simulate a button click it's almost identical
btnOpen_Click(sender, e).
Cheers,
Christian Blackburn

"Jerry" <Je*********@yahoo.com> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
There are a number of ways to do this.
Most likely the most straight forward way would be to have a subroutine
which performs the desired code you wish to run. Then, you can call this
subroutine either by calling it from the button event or from your other
code.
You dont want to raise the button event, you want to run the code which the button causes.

Regards

"touf" <to******@hotmail.com> wrote in message
news:Oz*************@tk2msftngp13.phx.gbl...
Hi,
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know how to use it ion this case.
Thanks


Nov 20 '05 #3
"Christian Blackburn" <Christian@Damn@Sp**@Hotmail.com> schrieb
Hi Touf,
For the most part I've gotta agree with Jerry. Unless you are
testing your button routine what he recommended is ideal. However
since you asked I'll go ahead and tell ya:
If I wanted to click a menu item from a button I'd just put the
following code in a button
mnuOpenGame_Click(sender, e)
so to simulate a button click it's almost identical
btnOpen_Click(sender, e).


Apart from the fact - that you are of course aware of - that's bad design
because the menu has not been clicked. Further more, a menu has a
PerformClick method (mnuOpenGame.PerformClick).
--
Armin

Nov 20 '05 #4
Hello,

"touf" <to******@hotmail.com> schrieb:
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know
how to use it ion this


'RaiseEvent' doesn't work here. Call the button's 'PerformClick' method.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #5

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

Similar topics

6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
4
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
3
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
7
by: code100579 | last post by:
Hi there, sorry if this is a really simple question. I need to write code for: If a button is pushed and then one variety of other buttons is pushed then certain options on the program will...
7
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
3
by: GauravGupta | last post by:
i want to know that is it posible to call button click event before page load event on post back.... please help me....
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
0
by: ADN | last post by:
Hi, I am currently extending the GridView control and would like to add a button to the GridView so that it will automatically render one button at the top of the grid. I have a click event for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
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...
0
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,...
0
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...
0
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...
0
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...

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.