Visual c++ forms keydown events not responding

so i added the keydown even to my form in order to try it but nothing happens when i click any of the buttons, i didnt forget to enable the key preview option but still no hope here is the code:

private: System::Void Form3_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e )
{
    if ( e->KeyCode == Keys::F1 )
    {
        textBox2->Text="Hey";
    }
    if ( e->KeyCode == Keys::Return )
    {
        textBox2->Text="Hey";
    }
    if ( e->KeyCode == Keys::E )
    {
        textBox2->Text="Hey";
    }
    if ( e->KeyCode == Keys::Shift )
    {
        textBox2->Text="Hey";
    }
    if ( e->KeyCode == Keys::NumPad0 )
    {
        textBox2->Text="Hey";
    }
    if ( e->KeyCode == Keys::Down )
    {
        textBox2->Text="Hey";
    }
}

Any help?

Answers


Set the Form KeyPreview property to True.


Need Your Help

jquery.ui.autocomplete not hitting stored procedure

jquery jquery-ui autocomplete

I have the following function that should return values based either on a Last Name or ID that is entered into a text box. It is not working on my base page which has several layers of tabs, and the

R : readBin and writeBin ( for storing/retrieving MySQL BLOBs or LONGBLOBs )

r binary blob

I'm using the readBin function to save a file as MySQL BLOB as described in this article ( http://www.r-bloggers.com/save-r-plot-as-a-blob/ )