Record Keystrokes in windows forms

Move a label with the arrow keys

Page 1 of 1

9 Replies - 6916 Views - Last Post: 14 June 2009 - 02:18 PM Rate Topic: -----

#1 orangeinternet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 14-June 09

Record Keystrokes in windows forms

Posted 14 June 2009 - 10:15 AM

How do you move a label using arrow keys?

Thanks in advance!
Is This A Good Question/Topic? 0
  • +

Replies To: Record Keystrokes in windows forms

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1010
  • View blog
  • Posts: 3,565
  • Joined: 05-June 09

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:18 AM

Handle the KeyPress/KeyDown/KeyUp event(s) as required.
Was This Post Helpful? 0
  • +
  • -

#3 orangeinternet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 14-June 09

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:19 AM

Can you show me some Code, (im not that good at C#)
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:23 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

#5 orangeinternet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 14-June 09

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:34 AM

I know your policy, i have researched it forever, and i was wondering if there was any simpler way (what i saw was very complicated)

Thanks
Was This Post Helpful? 0
  • +
  • -

#6 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1010
  • View blog
  • Posts: 3,565
  • Joined: 05-June 09

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:41 AM

Assigning event handlers is part of the C# language, it's fairly standard/basic stuff and any C# tutorial would teach you that :)
Was This Post Helpful? 0
  • +
  • -

#7 orangeinternet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 14-June 09

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:42 AM

None of the C# tutorials have even touched on it, what one are you thinking of?
Was This Post Helpful? 0
  • +
  • -

#8 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1010
  • View blog
  • Posts: 3,565
  • Joined: 05-June 09

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:51 AM

http://msdn.microsof...739(VS.71).aspx
http://www.softsteel...p/lesson16.html
http://www.csharp-st...s/Lesson14.aspx
http://www.switchont...event-accessors
http://www.devhood.c...tutorial_id=380
http://csharpcomputi...ls/Lesson15.htm
http://www.csharphel...archive253.html
http://www.geekpedia...-in-Csharp.html
http://www.switchont...-event-contents
Was This Post Helpful? 0
  • +
  • -

#9 danzar  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 108
  • Joined: 10-December 08

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 10:53 AM

View Postorangeinternet, on 14 Jun, 2009 - 09:34 AM, said:

I know your policy, i have researched it forever, and i was wondering if there was any simpler way (what i saw was very complicated)

Thanks



Then I would say that you need to learn up to the level of that. Just my thought's. Its not that hard just alot of reading and trail and error.
Was This Post Helpful? 0
  • +
  • -

#10 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1533
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Record Keystrokes in windows forms

Posted 14 June 2009 - 02:18 PM

don't forget that you need to set the "KeyPreview" property to "True" if you want the form itself to process keystrokes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1