hehe.. stop beep when pressing Enter
You know how the system beeps if you try to press
Enter in a single-line textbox...
Well, anyway, I making a usercontrol that I want to just pass a TAB along to the system... I found this code in C#, I know Pirate has # skills, so perhaps he can convert this to VB...
Code:
const int WM_KEYDOWN = 0x100;
const int WM_KEYUP = 0x101;
public override bool PreProcessMessage(ref
System.Windows.Forms.Message msg)
{
Keys keyCode=(Keys)(int)msg.WParam & Keys.KeyCode;
if((msg.Msg==WM_KEYDOWN || msg.Msg==WM_KEYUP) &&
keyCode==Keys.Enter)
{
msg.WParam=(System.IntPtr)Keys.Tab;
}
return base.PreProcessMessage(ref msg);
}
Here's what I have so far....
VB Code:
Dim keyCode As Keys = CType(msg.WParam, IntPtr).ToInt32
If msg.Msg = Convert.ToInt32("0x100") Then
If keyCode = Keys.Enter Then
msg.WParam = New IntPtr(Keys.Tab)
Return True
End If
End If
Return MyBase.ProcessKeyEventArgs(msg)
I think that's correct except msg.Msg = "0x100"
probably stops this routine from working correctly.
So, how do I say:
If msg.Msg = WM_KEYUP or msg.Msg = WM_KEYDOWN