aewarnick Posted July 15, 2003 Posted July 15, 2003 I have a form with one button on it. I have set KeyPreview to true so that the form first recieves all the keydown messages. The problem is that the button still recieves the arrow keys!! Why is that? Can it be fixed? I read somewhere that that was a .net 1 bug and was fixed in 1.1 but I installed 1.1 and it does not make a difference. Quote C#
*Gurus* divil Posted July 15, 2003 *Gurus* Posted July 15, 2003 See the IsInputKey method in MSDN, you'll have to override it. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
aewarnick Posted July 15, 2003 Author Posted July 15, 2003 Thanks divil. It was here too: http://www.syncfusion.com/faq/winforms/search/544.asp The famed faq! Quote C#
*Experts* DiverDan Posted July 16, 2003 *Experts* Posted July 16, 2003 Could someone please translate the C# code in VB.Net code? Thanks Dan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
aewarnick Posted July 16, 2003 Author Posted July 16, 2003 That code should be very easy to translate to VB .net code. If you can't figure it out, there are C# to VB .net translators on the net and vise versa. Quote C#
*Experts* mutant Posted July 16, 2003 *Experts* Posted July 16, 2003 Could someone please translate the C# code in VB.Net code? Thanks Dan Its very simple translation :): Protected Overrides Function IsInputKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean Select case keyData case Keys.Up return True case Keys.Down return True case Keys.Right return True case Keys.Left return True End Select MyBase.IsInputKey(keyData) End Function Quote
*Experts* DiverDan Posted July 16, 2003 *Experts* Posted July 16, 2003 Thanks mutant, I have another thread also dealing with this. After creating this and other override events and then using the keydown and key press events...nothing happens??? I'm really stuck on this one, please help!!! keypreview is set to true. Thanks Dan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
aewarnick Posted July 16, 2003 Author Posted July 16, 2003 I didn't test with IsInputKey yet but I answered your post and am pretty sure it is correct. Quote C#
Leaders dynamic_sysop Posted July 17, 2003 Leaders Posted July 17, 2003 here ya go , took me a while of messing but i sussed it :) Private Const VK_UP As Integer = CInt(&H26) Private Const VK_RIGHT As Integer = CInt(&H27) Private Const VK_LEFT As Integer = CInt(&H25) Private Const VK_DOWN As Integer = CInt(&H28) Protected Overrides Function ProcessKeyPreview(ByRef m As System.Windows.Forms.Message) As Boolean Select Case m.WParam.ToInt32 Case VK_UP MsgBox("up") Case VK_DOWN MsgBox("down") Case VK_LEFT MsgBox("left") Case VK_RIGHT MsgBox("right") End Select End Function Quote
aewarnick Posted July 17, 2003 Author Posted July 17, 2003 Thanks dynamic. I'll try it out some time. Quote C#
*Experts* DiverDan Posted July 17, 2003 *Experts* Posted July 17, 2003 (edited) Thanks also dynamic!!! This one drove me nuts and you got it!! Dan Edited July 17, 2003 by DiverDan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.