Haiasc_123


Hi all,

I try to override ProcessCmdKey on a TextBox to change: keys.Up -> (Shift & Tab),
my code like this

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Up)
return this.ProcessDialogKey(Keys.ShiftKey & Keys.Tab);

else
return base.ProcessCmdKey(ref msg, keyData);
}

but it is not ok, ProcessDialogKey(keyData) can't receive a combine key like this

Pls help me!!!



Re: Visual C# General How to use ProcessCmdKey(msg, keyData) and ProcessDialogKey(keyData) like this???

Karthikeya Pavan Kumar .B

You need to use Keys.Shift + Keys.Tab






Re: Visual C# General How to use ProcessCmdKey(msg, keyData) and ProcessDialogKey(keyData) like this???

Haiasc_123

Thks very much, Karthikeya Pavan Kumar .B,

I tried to change as your help:

...
return this.ProcessDialogKey(Keys.ShiftKey + Keys.Tab);
...

but it occur an error : "Operator '+' cannot be applied to operands of type 'System.Windows.Forms.Keys' and 'System.Windows.Forms.Keys' "

pls help me,








Re: Visual C# General How to use ProcessCmdKey(msg, keyData) and ProcessDialogKey(keyData) like this???

Mario Cossi

Keys is an enumeration with the Flags attribute. You can combine a key with its modifiers by using the bitwise or.

Try:

... return this.ProcessDialogKey (Keys.Shift | Keys.Tab);

HTH

--mc





Re: Visual C# General How to use ProcessCmdKey(msg, keyData) and ProcessDialogKey(keyData) like this???

Haiasc_123

Thankyou very much, Mario Cossi,

I got it!!!