473,499 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to invoke a button Click Event programmatically?

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
programmatically invoke the MoveNext Click event? How to do this?

Thanks,
Rich
Apr 26 '07 #1
8 19137
huh???
Just call that click method directly, what is the problem???
--
cheers,
RL
"Rich" <Ri**@discussions.microsoft.comwrote in message
news:E4**********************************@microsof t.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
programmatically invoke the MoveNext Click event? How to do this?

Thanks,
Rich

Apr 26 '07 #2
Private Sub btnMoveNext_Click(...) Handles btnMoveNext.Click

If I call btnMoveNext_Click -- 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**@discussions.microsoft.comwrote in message
news:E4**********************************@microsof t.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
programmatically invoke the MoveNext Click event? How to do this?

Thanks,
Rich


Apr 26 '07 #3
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

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**@discussions.microsoft.comwrote in message
news:E4**********************************@microsof t.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
programmatically invoke the MoveNext Click event? How to do this?

Thanks,
Rich


Apr 26 '07 #4
=?Utf-8?B?UmljaA==?= <Ri**@discussions.microsoft.comwrote in
news:6A**********************************@microsof t.com:
If I call btnMoveNext_Click -- 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**@discussions.microsoft.comwrote in
news:6A**********************************@microsof t.com:
If I call btnMoveNext_Click -- 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...@discussions.microsoft.comwrote:
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
programmatically 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_Click(...) Handles btnMoveNext.Click

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

btnMoveNext.PerformClick()
ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Apr 26 '07 #8
"RickH" <pa******@windcrestsoftware.comschrieb:
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.Empty' 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...
21
6530
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
2830
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
4007
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...
3
4252
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...
17
9615
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...
7
6843
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
21041
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
2859
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
7130
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,...
0
7220
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
7386
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...
0
5468
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,...
1
4918
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...
0
4599
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...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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 ...
0
295
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...

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.