Click here to Skip to main content
15,892,161 members
Home / Discussions / C#
   

C#

 
Questionhow to get holding key down to repeat an action Pin
bradsnobar27-Oct-06 14:07
bradsnobar27-Oct-06 14:07 
AnswerRe: how to get holding key down to repeat an action Pin
sam#27-Oct-06 18:21
sam#27-Oct-06 18:21 
GeneralRe: how to get holding key down to repeat an action Pin
bradsnobar27-Oct-06 21:15
bradsnobar27-Oct-06 21:15 
AnswerRe: how to get holding key down to repeat an action Pin
Nader Elshehabi27-Oct-06 20:56
Nader Elshehabi27-Oct-06 20:56 
GeneralRe: how to get holding key down to repeat an action Pin
bradsnobar27-Oct-06 21:15
bradsnobar27-Oct-06 21:15 
GeneralRe: how to get holding key down to repeat an action Pin
Nader Elshehabi27-Oct-06 21:31
Nader Elshehabi27-Oct-06 21:31 
AnswerFound the answer Pin
bradsnobar27-Oct-06 21:20
bradsnobar27-Oct-06 21:20 
GeneralRe: Found the answer Pin
DiegoValdevino28-Oct-06 3:18
DiegoValdevino28-Oct-06 3:18 
Some quote from the MSDN[^] site:

"The KeyPress event is not raised by noncharacter keys; however, the noncharacter keys do raise the KeyDown and KeyUp events." You should do Keydown's instead of ProcessCmdKey, that's what you are doing anyways...
bradsnobar wrote:
switch (msg.Msg)
{
case WM_KEYDOWN:


Just do it on the .NET way.

bradsnobar wrote:
switch (keyData)
{
case Keys.Down:


You could write your switch statement on OnKeyDown method:
private void yourcontrol_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    switch(e.KeyCode)
    {
        case Key.Down:
        //Do something
        ...
    }
    ...
}

Beside, embedding System const's in your code is not a nice thing to do. Microsoft could just change the values and your code will go to the outerspace.Laugh | :laugh:


ps.: Some words from MSDN[^]:

Notes to Inheritors When overriding the ProcessCmdKey method in a derived class, a control should return true to indicate that it has processed the key. For keys that are not processed by the control, the result of calling the base class's ProcessCmdKey method should be returned. Controls will seldom, if ever, need to override this method.

Diego Valdevino
Questionstore procedure vs hard coding sql statements Pin
keroed_edmond27-Oct-06 12:07
keroed_edmond27-Oct-06 12:07 
AnswerRe: store procedure vs hard coding sql statements Pin
bradsnobar27-Oct-06 14:20
bradsnobar27-Oct-06 14:20 
AnswerRe: store procedure vs hard coding sql statements Pin
Rob Graham27-Oct-06 14:29
Rob Graham27-Oct-06 14:29 
AnswerRe: store procedure vs hard coding sql statements Pin
Tad McClellan27-Oct-06 16:31
professionalTad McClellan27-Oct-06 16:31 
AnswerRe: store procedure vs hard coding sql statements Pin
Pete O'Hanlon30-Oct-06 2:02
mvePete O'Hanlon30-Oct-06 2:02 
QuestionIs it possible to write app. for symbian by VS2005 and C# or VB.NET? Pin
Code4Null27-Oct-06 10:49
Code4Null27-Oct-06 10:49 
AnswerRe: Is it possible to write app. for symbian by VS2005 and C# or VB.NET? Pin
led mike27-Oct-06 11:01
led mike27-Oct-06 11:01 
GeneralRe: Is it possible to write app. for symbian by VS2005 and C# or VB.NET? Pin
Code4Null27-Oct-06 11:24
Code4Null27-Oct-06 11:24 
GeneralRe: Is it possible to write app. for symbian by VS2005 and C# or VB.NET? Pin
Rob Graham27-Oct-06 11:30
Rob Graham27-Oct-06 11:30 
GeneralRe: Is it possible to write app. for symbian by VS2005 and C# or VB.NET? Pin
led mike27-Oct-06 11:35
led mike27-Oct-06 11:35 
AnswerRe: Is it possible to write app. for symbian by VS2005 and C# or VB.NET? Pin
Nader Elshehabi27-Oct-06 20:27
Nader Elshehabi27-Oct-06 20:27 
QuestionSql Command with C# Pin
Areff27-Oct-06 9:56
Areff27-Oct-06 9:56 
AnswerRe: Sql Command with C# Pin
led mike27-Oct-06 10:08
led mike27-Oct-06 10:08 
AnswerRe: Sql Command with C# Pin
BoneSoft27-Oct-06 10:10
BoneSoft27-Oct-06 10:10 
AnswerRe: Sql Command with C# Pin
Rob Graham27-Oct-06 10:36
Rob Graham27-Oct-06 10:36 
GeneralRe: Sql Command with C# Pin
BoneSoft27-Oct-06 10:44
BoneSoft27-Oct-06 10:44 
QuestionRe: Sql Command with C# Pin
BoneSoft27-Oct-06 10:50
BoneSoft27-Oct-06 10:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.