By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,992 Members | 967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,992 IT Pros & Developers. It's quick & easy.

how to invoke a button Click Event programmatically?

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
=?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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.