Hotkey for custom field

you probably have to set the "keypreview"-property of the form to
"true"
As I didn't find the property in the property-listbox I added

salesorderform.keypreview = true

at the form.load-event.

Jan

--- In vantage@yahoogroups.com, "Michael
McWilliams" <mmcwilliams22@...> wrote:
>
> What is the code you are running from that to fire the button. I
> could not get it to work on any of the forms. I tested using a
> messagebox.
> Here is what my code looked like
> Private Sup SalesOrderForm_KeyUp(ByVal sender As object, ByVal args
> As System.Windows.Forms.KeyEventArgs) Handles SalesOrderForm.KeyUp
> If Args.KeyCode = Keys.F2 Then
> MessageBox.Show ("You Hit F2")
>
>
> --- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@>
> wrote:
> >
> > works now ;)
> >
> > had to use
> >
> > Private Sub SalesOrderForm_KeyUp(ByVal sender As object, ByVal
args
> > As System.Windows.Forms.KeyEventArgs) Handles SalesOrderForm.KeyUp
> >
> > to get the event.
> >
> > Thanks to all
> > Jan
> >
> > --- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@>
> > wrote:
> > >
> > > Thanks!
> > > It works fine as long the focus is on the button.
> > > If I try it on the form itself i get the following error:
> > >
> > > Method 'SalesOrderForm_KeyUp' cannot handle Event 'Keydown'
> because
> > > they do not have the same signature.
> > >
> > > Any idea how to get this working? (or what the error means?)
> > >
> > > Thanks
> > > Jan
> > >
> > > P.S.:sorry, I'm still kinda new to .net
> > >
> > > --- In vantage@yahoogroups.com, "Michael
> > > McWilliams" <mmcwilliams22@> wrote:
> > > >
> > > > I was thinking backwards.
> > > > You can try something like:
> > > > Private Sub nedEpiCustom1_KeyUp(ByVal Sender As Object,
> ByVal
> > > Args
> > > > As System.Windows.Forms.KeyEventArgs) Handles
> nedEpiCustom1.KeyUp
> > > >
> > > > If Args.KeyCode = Keys.F2 Then
> > > >
> > > > //**Whatever Code You Want to Run
> > > >
> > > > But you have to hit f2 when in nedEpiCustom1
> > > >
> > > > I am not sure how or if it can work by using the form or
> > something
> > > > else. Say QuoteForm_KeyUp
> > > >
> > > >
> > > >
> > > >
> > > > --- In vantage@yahoogroups.com,
"backbencherjan" <jehrlenbach@>
> > > > wrote:
> > > > >
> > > > > --- In vantage@yahoogroups.com, "Mark
Wonsil" <mark_wonsil@>
> > > wrote:
> > > > > >
> > > > > > > Private Sub btnEpiCustom1_Click(ByVal Sender As Object,
> > ByVal
> > > > > Args As
> > > > > > > System.EventArgs) Handles btnEpiCustom1.Click
> > > > > > > Sendkeys.Send("{F2}")
> > > > > > >
> > > > > > > When the button is clicked it will send F2
> > > > > >
> > > > > > Was Jan asking for this or the opposite? Did she want to
> > assign
> > > > F2
> > > > > to her
> > > > > > EpiButton?
> > > > > >
> > > > > actually I wanted just the opposite :)
> > > > > So, if a user presses F2 the custom button should be
pressed.
> > > > >
> > > > > Thanks
> > > > > Jan
> > > > >
> > > >
> > >
> >
>
hi,

Is there any way to assign a hotkey (i.e. F2) to a customized button
on a form? (for example by checking the keypressed-event of the form
?)

Thank you

Jan
Yes, here is an example. Use the event wizard for the button you
want and use Sendkeys.send
for example:


Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal Args As
System.EventArgs) Handles btnEpiCustom1.Click
Sendkeys.Send("{F2}")


When the button is clicked it will send F2
--- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@...>
wrote:
>
> hi,
>
> Is there any way to assign a hotkey (i.e. F2) to a customized
button
> on a form? (for example by checking the keypressed-event of the form
> ?)
>
> Thank you
>
> Jan
>
> Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal Args As
> System.EventArgs) Handles btnEpiCustom1.Click
> Sendkeys.Send("{F2}")
>
> When the button is clicked it will send F2

Was Jan asking for this or the opposite? Did she want to assign F2 to her
EpiButton?
--- In vantage@yahoogroups.com, "Mark Wonsil" <mark_wonsil@...> wrote:
>
> > Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal
Args As
> > System.EventArgs) Handles btnEpiCustom1.Click
> > Sendkeys.Send("{F2}")
> >
> > When the button is clicked it will send F2
>
> Was Jan asking for this or the opposite? Did she want to assign F2
to her
> EpiButton?
>
actually I wanted just the opposite :)
So, if a user presses F2 the custom button should be pressed.

Thanks
Jan
I was thinking backwards.
You can try something like:
Private Sub nedEpiCustom1_KeyUp(ByVal Sender As Object, ByVal Args
As System.Windows.Forms.KeyEventArgs) Handles nedEpiCustom1.KeyUp

If Args.KeyCode = Keys.F2 Then

//**Whatever Code You Want to Run

But you have to hit f2 when in nedEpiCustom1

I am not sure how or if it can work by using the form or something
else. Say QuoteForm_KeyUp




--- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@...>
wrote:
>
> --- In vantage@yahoogroups.com, "Mark Wonsil" <mark_wonsil@> wrote:
> >
> > > Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal
> Args As
> > > System.EventArgs) Handles btnEpiCustom1.Click
> > > Sendkeys.Send("{F2}")
> > >
> > > When the button is clicked it will send F2
> >
> > Was Jan asking for this or the opposite? Did she want to assign
F2
> to her
> > EpiButton?
> >
> actually I wanted just the opposite :)
> So, if a user presses F2 the custom button should be pressed.
>
> Thanks
> Jan
>
Thanks!
It works fine as long the focus is on the button.
If I try it on the form itself i get the following error:

Method 'SalesOrderForm_KeyUp' cannot handle Event 'Keydown' because
they do not have the same signature.

Any idea how to get this working? (or what the error means?)

Thanks
Jan

P.S.:sorry, I'm still kinda new to .net

--- In vantage@yahoogroups.com, "Michael
McWilliams" <mmcwilliams22@...> wrote:
>
> I was thinking backwards.
> You can try something like:
> Private Sub nedEpiCustom1_KeyUp(ByVal Sender As Object, ByVal
Args
> As System.Windows.Forms.KeyEventArgs) Handles nedEpiCustom1.KeyUp
>
> If Args.KeyCode = Keys.F2 Then
>
> //**Whatever Code You Want to Run
>
> But you have to hit f2 when in nedEpiCustom1
>
> I am not sure how or if it can work by using the form or something
> else. Say QuoteForm_KeyUp
>
>
>
>
> --- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@>
> wrote:
> >
> > --- In vantage@yahoogroups.com, "Mark Wonsil" <mark_wonsil@>
wrote:
> > >
> > > > Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal
> > Args As
> > > > System.EventArgs) Handles btnEpiCustom1.Click
> > > > Sendkeys.Send("{F2}")
> > > >
> > > > When the button is clicked it will send F2
> > >
> > > Was Jan asking for this or the opposite? Did she want to assign
> F2
> > to her
> > > EpiButton?
> > >
> > actually I wanted just the opposite :)
> > So, if a user presses F2 the custom button should be pressed.
> >
> > Thanks
> > Jan
> >
>
works now ;)

had to use

Private Sub SalesOrderForm_KeyUp(ByVal sender As object, ByVal args
As System.Windows.Forms.KeyEventArgs) Handles SalesOrderForm.KeyUp

to get the event.

Thanks to all
Jan

--- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@...>
wrote:
>
> Thanks!
> It works fine as long the focus is on the button.
> If I try it on the form itself i get the following error:
>
> Method 'SalesOrderForm_KeyUp' cannot handle Event 'Keydown' because
> they do not have the same signature.
>
> Any idea how to get this working? (or what the error means?)
>
> Thanks
> Jan
>
> P.S.:sorry, I'm still kinda new to .net
>
> --- In vantage@yahoogroups.com, "Michael
> McWilliams" <mmcwilliams22@> wrote:
> >
> > I was thinking backwards.
> > You can try something like:
> > Private Sub nedEpiCustom1_KeyUp(ByVal Sender As Object, ByVal
> Args
> > As System.Windows.Forms.KeyEventArgs) Handles nedEpiCustom1.KeyUp
> >
> > If Args.KeyCode = Keys.F2 Then
> >
> > //**Whatever Code You Want to Run
> >
> > But you have to hit f2 when in nedEpiCustom1
> >
> > I am not sure how or if it can work by using the form or
something
> > else. Say QuoteForm_KeyUp
> >
> >
> >
> >
> > --- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@>
> > wrote:
> > >
> > > --- In vantage@yahoogroups.com, "Mark Wonsil" <mark_wonsil@>
> wrote:
> > > >
> > > > > Private Sub btnEpiCustom1_Click(ByVal Sender As Object,
ByVal
> > > Args As
> > > > > System.EventArgs) Handles btnEpiCustom1.Click
> > > > > Sendkeys.Send("{F2}")
> > > > >
> > > > > When the button is clicked it will send F2
> > > >
> > > > Was Jan asking for this or the opposite? Did she want to
assign
> > F2
> > > to her
> > > > EpiButton?
> > > >
> > > actually I wanted just the opposite :)
> > > So, if a user presses F2 the custom button should be pressed.
> > >
> > > Thanks
> > > Jan
> > >
> >
>
What is the code you are running from that to fire the button. I
could not get it to work on any of the forms. I tested using a
messagebox.
Here is what my code looked like
Private Sup SalesOrderForm_KeyUp(ByVal sender As object, ByVal args
As System.Windows.Forms.KeyEventArgs) Handles SalesOrderForm.KeyUp
If Args.KeyCode = Keys.F2 Then
MessageBox.Show ("You Hit F2")


--- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@...>
wrote:
>
> works now ;)
>
> had to use
>
> Private Sub SalesOrderForm_KeyUp(ByVal sender As object, ByVal args
> As System.Windows.Forms.KeyEventArgs) Handles SalesOrderForm.KeyUp
>
> to get the event.
>
> Thanks to all
> Jan
>
> --- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@>
> wrote:
> >
> > Thanks!
> > It works fine as long the focus is on the button.
> > If I try it on the form itself i get the following error:
> >
> > Method 'SalesOrderForm_KeyUp' cannot handle Event 'Keydown'
because
> > they do not have the same signature.
> >
> > Any idea how to get this working? (or what the error means?)
> >
> > Thanks
> > Jan
> >
> > P.S.:sorry, I'm still kinda new to .net
> >
> > --- In vantage@yahoogroups.com, "Michael
> > McWilliams" <mmcwilliams22@> wrote:
> > >
> > > I was thinking backwards.
> > > You can try something like:
> > > Private Sub nedEpiCustom1_KeyUp(ByVal Sender As Object,
ByVal
> > Args
> > > As System.Windows.Forms.KeyEventArgs) Handles
nedEpiCustom1.KeyUp
> > >
> > > If Args.KeyCode = Keys.F2 Then
> > >
> > > //**Whatever Code You Want to Run
> > >
> > > But you have to hit f2 when in nedEpiCustom1
> > >
> > > I am not sure how or if it can work by using the form or
> something
> > > else. Say QuoteForm_KeyUp
> > >
> > >
> > >
> > >
> > > --- In vantage@yahoogroups.com, "backbencherjan" <jehrlenbach@>
> > > wrote:
> > > >
> > > > --- In vantage@yahoogroups.com, "Mark Wonsil" <mark_wonsil@>
> > wrote:
> > > > >
> > > > > > Private Sub btnEpiCustom1_Click(ByVal Sender As Object,
> ByVal
> > > > Args As
> > > > > > System.EventArgs) Handles btnEpiCustom1.Click
> > > > > > Sendkeys.Send("{F2}")
> > > > > >
> > > > > > When the button is clicked it will send F2
> > > > >
> > > > > Was Jan asking for this or the opposite? Did she want to
> assign
> > > F2
> > > > to her
> > > > > EpiButton?
> > > > >
> > > > actually I wanted just the opposite :)
> > > > So, if a user presses F2 the custom button should be pressed.
> > > >
> > > > Thanks
> > > > Jan
> > > >
> > >
> >
>