Re: Call Sub vs. fake a key press
From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 07/31/04
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: match a blank line with RegEx"
- Previous message: Jay B. Harlow [MVP - Outlook]: "Re: Type Casting"
- In reply to: Ricky W. Hunt: "Call Sub vs. fake a key press"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 31 Jul 2004 14:01:27 -0500
Ricky,
What kind of "buttons" are we talking about?
Rather then calling an event handler directly, as there may actually be
multiple event handlers attached to the button. You can simply call
Button.PerformClick.
Hope this helps
Jay
"Ricky W. Hunt" <rhunt22@hotmail.com> wrote in message
news:PINOc.220130$Oq2.52920@attbi_s52...
> First, the subject probably doesn't use the correct terms but I'm not sure
> what it's called in VB.
>
> I'm writing a media player app. The subroutine that handles the "open
file"
> button contains an If statement to see if a file was already playing and
if
> so executes some code to stop the previous file from playing among other
> things. There's also a "stop" button on the form that contains the exact
> same code. Obviously it would be easier if there was just one subroutine
> containing the code and that sub would be called from the If in the open
> routine and from the stop routine. My question is, is there a way to make
> the program think the "Stop" button was pressed? I.E. is there anything
> statement I can put in the If statement in the "open file" sub that will
> "trigger" just the same as if the "stop" button had been pressed? If so,
are
> there any caveats to faking a button click from within the program versus
> just putting the code in a sub and calling it from both events?
>
> --
> Thanks,
> Ricky W. Hunt
> freendeed
>
>
- Next message: Jay B. Harlow [MVP - Outlook]: "Re: match a blank line with RegEx"
- Previous message: Jay B. Harlow [MVP - Outlook]: "Re: Type Casting"
- In reply to: Ricky W. Hunt: "Call Sub vs. fake a key press"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|