473,549 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 31527
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******@hotma il.com> wrote in message
news:Oz******** *****@tk2msftng p13.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_Cli ck(sender, e)
so to simulate a button click it's almost identical
btnOpen_Click(s ender, e).
Cheers,
Christian Blackburn

"Jerry" <Je*********@ya hoo.com> wrote in message
news:Os******** ******@TK2MSFTN GP10.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******@hotma il.com> wrote in message
news:Oz******** *****@tk2msftng p13.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.c om> 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_Cli ck(sender, e)
so to simulate a button click it's almost identical
btnOpen_Click(s ender, 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.Pe rformClick).
--
Armin

Nov 20 '05 #4
Hello,

"touf" <to******@hotma il.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
2833
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 data from the button is not available at this time as to allow the table to properly update. So basically, I need to call UpdateTable() twice, once...
4
4014
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 ontop of the webform1: Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code "
11
13874
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 all users (btnSendAll). When user hits enter, I also simulate the effect of clicking button (btnSend). However, what I found btnSend doesn't fire...
3
8727
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 twice, once with postback true, and second time without postback. This only happens for this button. How can I sort out this issue, any clues what...
7
41758
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 become "greyed out". Ie they can no longer be selected. I assume i need to create an event from the first button being pushed and then do if...
7
6851
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, it is not work, anyone can tell how to use button click event ? Thanks in advance, Martin
3
21060
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
6978
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 page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of...
0
2866
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 that button, but everytime the button is clicked, the page posts back and the click event does not fire (probably because the button gets created...
0
7520
marktang
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...
0
7718
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. ...
1
7470
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...
1
5368
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
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
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...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1936
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
1058
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.