473,624 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to invoke a button Click Event programmaticall y?

My from contains a "Move Next" button. When the user clicks on the "Move
Next" button - several procedures get invoked and eventually, the dataset
underlying the form will display main data from the next record and will
display detail data in a datagridview also on the form which is related to
the current main record in view.

Another button ("Transfer Account") on the form can modify what detail data
is related to the current main record. When this button gets clicked I have
to update the view the form is currently displaying. This means I have to
reload the main data and detail data and increment the dataset to display the
main record that was currently in view and display the modified detail data.

If the main dataset contains 10 records, and the user is on record 7, the
form needs to display record 7 after the "Transfer Account" button has been
clicked and also display the updated Detail records in the datagrid view.
Say there were 5 detail records in the datagridview for main record 7. Then
2 detail records get transferred out. I need to reload the whole dataset so
that main and detail data remain synchronized.

Reloading the dataset is easy - except that I end up on the first record. I
need to move next till I am back on the 7th record. Rather than rewriting
the Move Next code in the "Transfer Account" button, is there a way I can
programmaticall y invoke the MoveNext Click event? How to do this?

Thanks,
Rich
Apr 26 '07 #1
8 19155
huh???
Just call that click method directly, what is the problem???
--
cheers,
RL
"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:E4******** *************** ***********@mic rosoft.com...
My from contains a "Move Next" button. When the user clicks on the "Move
Next" button - several procedures get invoked and eventually, the dataset
underlying the form will display main data from the next record and will
display detail data in a datagridview also on the form which is related to
the current main record in view.

Another button ("Transfer Account") on the form can modify what detail
data
is related to the current main record. When this button gets clicked I
have
to update the view the form is currently displaying. This means I have to
reload the main data and detail data and increment the dataset to display
the
main record that was currently in view and display the modified detail
data.

If the main dataset contains 10 records, and the user is on record 7, the
form needs to display record 7 after the "Transfer Account" button has
been
clicked and also display the updated Detail records in the datagrid view.
Say there were 5 detail records in the datagridview for main record 7.
Then
2 detail records get transferred out. I need to reload the whole dataset
so
that main and detail data remain synchronized.

Reloading the dataset is easy - except that I end up on the first record.
I
need to move next till I am back on the 7th record. Rather than rewriting
the Move Next code in the "Transfer Account" button, is there a way I can
programmaticall y invoke the MoveNext Click event? How to do this?

Thanks,
Rich

Apr 26 '07 #2
Private Sub btnMoveNext_Cli ck(...) Handles btnMoveNext.Cli ck

If I call btnMoveNext_Cli ck -- that won't interfere with the Handles part?
I guess I am going to find out.

"Egghead" wrote:
huh???
Just call that click method directly, what is the problem???
--
cheers,
RL
"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:E4******** *************** ***********@mic rosoft.com...
My from contains a "Move Next" button. When the user clicks on the "Move
Next" button - several procedures get invoked and eventually, the dataset
underlying the form will display main data from the next record and will
display detail data in a datagridview also on the form which is related to
the current main record in view.

Another button ("Transfer Account") on the form can modify what detail
data
is related to the current main record. When this button gets clicked I
have
to update the view the form is currently displaying. This means I have to
reload the main data and detail data and increment the dataset to display
the
main record that was currently in view and display the modified detail
data.

If the main dataset contains 10 records, and the user is on record 7, the
form needs to display record 7 after the "Transfer Account" button has
been
clicked and also display the updated Detail records in the datagrid view.
Say there were 5 detail records in the datagridview for main record 7.
Then
2 detail records get transferred out. I need to reload the whole dataset
so
that main and detail data remain synchronized.

Reloading the dataset is easy - except that I end up on the first record.
I
need to move next till I am back on the 7th record. Rather than rewriting
the Move Next code in the "Transfer Account" button, is there a way I can
programmaticall y invoke the MoveNext Click event? How to do this?

Thanks,
Rich


Apr 26 '07 #3
Private Sub btnNext_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s)

This is the part I am having the problem with - the event args

"Egghead" wrote:
huh???
Just call that click method directly, what is the problem???
--
cheers,
RL
"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:E4******** *************** ***********@mic rosoft.com...
My from contains a "Move Next" button. When the user clicks on the "Move
Next" button - several procedures get invoked and eventually, the dataset
underlying the form will display main data from the next record and will
display detail data in a datagridview also on the form which is related to
the current main record in view.

Another button ("Transfer Account") on the form can modify what detail
data
is related to the current main record. When this button gets clicked I
have
to update the view the form is currently displaying. This means I have to
reload the main data and detail data and increment the dataset to display
the
main record that was currently in view and display the modified detail
data.

If the main dataset contains 10 records, and the user is on record 7, the
form needs to display record 7 after the "Transfer Account" button has
been
clicked and also display the updated Detail records in the datagrid view.
Say there were 5 detail records in the datagridview for main record 7.
Then
2 detail records get transferred out. I need to reload the whole dataset
so
that main and detail data remain synchronized.

Reloading the dataset is easy - except that I end up on the first record.
I
need to move next till I am back on the 7th record. Rather than rewriting
the Move Next code in the "Transfer Account" button, is there a way I can
programmaticall y invoke the MoveNext Click event? How to do this?

Thanks,
Rich


Apr 26 '07 #4
=?Utf-8?B?UmljaA==?= <Ri**@discussio ns.microsoft.co mwrote in
news:6A******** *************** ***********@mic rosoft.com:
If I call btnMoveNext_Cli ck -- that won't interfere with the Handles
part? I guess I am going to find out.
Nope :-)

For the paramters, just pass in dummy values (null or new eventargs, etc)
Apr 26 '07 #5
Thanks

"Spam Catcher" wrote:
=?Utf-8?B?UmljaA==?= <Ri**@discussio ns.microsoft.co mwrote in
news:6A******** *************** ***********@mic rosoft.com:
If I call btnMoveNext_Cli ck -- that won't interfere with the Handles
part? I guess I am going to find out.

Nope :-)

For the paramters, just pass in dummy values (null or new eventargs, etc)
Apr 26 '07 #6
On Apr 26, 11:34 am, Rich <R...@discussio ns.microsoft.co mwrote:
My from contains a "Move Next" button. When the user clicks on the "Move
Next" button - several procedures get invoked and eventually, the dataset
underlying the form will display main data from the next record and will
display detail data in a datagridview also on the form which is related to
the current main record in view.

Another button ("Transfer Account") on the form can modify what detail data
is related to the current main record. When this button gets clicked I have
to update the view the form is currently displaying. This means I have to
reload the main data and detail data and increment the dataset to display the
main record that was currently in view and display the modified detail data.

If the main dataset contains 10 records, and the user is on record 7, the
form needs to display record 7 after the "Transfer Account" button has been
clicked and also display the updated Detail records in the datagrid view.
Say there were 5 detail records in the datagridview for main record 7. Then
2 detail records get transferred out. I need to reload the whole dataset so
that main and detail data remain synchronized.

Reloading the dataset is easy - except that I end up on the first record. I
need to move next till I am back on the 7th record. Rather than rewriting
the Move Next code in the "Transfer Account" button, is there a way I can
programmaticall y invoke the MoveNext Click event? How to do this?

Thanks,
Rich
Like other said calling the click event function directly is least
clunky way, just pass Nothing's to it an add some IsNothing checks to
the handler if you are referencing the "sender" or "e" parameters
currently.
Apr 26 '07 #7
Rich wrote:
Private Sub btnMoveNext_Cli ck(...) Handles btnMoveNext.Cli ck

If I call btnMoveNext_Cli ck -- that won't interfere with the Handles part?
I guess I am going to find out.
Just use -

btnMoveNext.Per formClick()
ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Apr 26 '07 #8
"RickH" <pa******@windc restsoftware.co mschrieb:
Like other said calling the click event function directly is least
clunky way, just pass Nothing's to it an add some IsNothing checks to
the handler if you are referencing the "sender" or "e" parameters
currently.
I'd pass 'EventArgs.Empt y' or a proper 'MouseEventArgs ' instance instead of
'Nothing' because it's *very* uncommon that the parameters' values are
'Nothing'.

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

Apr 27 '07 #9

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

Similar topics

3
693
by: Cary Linkfield | last post by:
I have a standard form I use. It inherits from Windows.Forms.Form. I usually add a Cancel button the form in the designer. I want to raise the Cancel button's Click event when the user presses the escape key. Public Class myStandardForm Inherits Windows.Forms.Form Private WithEvents _btnCancel As Button Private Sub _Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
21
6558
by: news.btinternnet.com | last post by:
I can do this in IE myLink.click(); //Invoking the handler as if the user had clicked on the link themselves. I need to be able to do the same in Netscape Navigator, can anyone help ?
6
2837
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 from page load and once from button. This causes problems with my application, and I was trying...
4
4016
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 "
3
4263
by: Robert W. | last post by:
I'm new to ASP.net programming so excuse my ignorance if the following question seems overly simplistic. I've created a simple Login form with 3 primary WebControls: - A TextBox for the Username - A TextBox for the Password - A Button labelled "Submit" If the user enters a correct username/password combination then he's taken to another page. But if either or both are incorrect then a simple message
17
9641
by: Eric | last post by:
I'm new to JavaScript and I wrote this code to play with. Oddly, if I enter text in a box and then press the button, I only get the onChange event for the text box and not the button's onclick event. But if I press the button without entering text first, the button click event does work. What's up? <html> <body> <h3>Events on Buttons and Text Boxes</h3>
7
6860
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
21097
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....
0
2876
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 every single time there's a postback). What is the best way for me to create this button and then...
0
8233
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8675
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8619
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
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,...
0
7158
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4078
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...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
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...

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.