CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Key Down Event

  1. #1
    Join Date
    Jan 2009
    Posts
    146

    Key Down Event

    I am trying to create a simple MessageBox as I hit the Down Arrow Key, below is my code(Windows Forms):


    Code:
    private: System::Void Form1_KeyDown(System::Object^  sender, System::Windows::Forms::KeyEventArgs^  e) 
    			 {
    				 MessageBox::Show("Error: There was an error in showing the previous error message","@_@");
    			 }
    Nothing happens as I press the Down Arrow Key during runtime, Please help! Thanks
    Last edited by Elite Commando; May 19th, 2009 at 08:58 AM.

  2. #2
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Key Down Event

    set form's KeyPreview property to true
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured