Befuddled about SendKey

  • Thread starter Thread starter Christy Davids
  • Start date Start date
C

Christy Davids

Hi guys,

I'm trying to use System.Windows.Forms.SendKeys.Send({UP})
to programmatically send an up arrow keystroke to my
application. According to the .NET Framework class
library documentation, this is the correct syntax (i.e.
using UP inside braces to indicate the up arrow key), but
when I do so I get an "expression expected" compiler error.

What am I missing here?

TIA! :)
Christy
 
Put it in quotes.
e.g.
System.Windows.Forms.SendKeys.Send("{UP}")
 
SendKeys.Send requires a string as the parameter. Enclose {UP} in
quotations to make it a string.
 
Thanks guys.

I swear I'd tried that, as well as declaring a string,
assigning it a value of "{UP}" and passing it to
SendKeys.Send... but I must have had a typo or something
because I couldn't get it to work. Anyway, works fine now.

Christy (feeling stupid)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top