473,466 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

extra characters in textbox when using shortcut keys

In VS 2003 and VS 2005 beta 2 I am trying to write a simple program. It has
a datagrid and a textbox along with a menubar. There is a command in the
menu bar which is "Run Query" and has the shortcut key of Ctrl + R If I am
typing in my textbox and hit Ctrl + R an extra r character will show up in
the textbox. I decided to then try this in VS 2005 and the same thing
happens. If I include the following,

Private Sub txtQuery_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles txtQuery.KeyDown
If e.KeyCode = Keys.R And e.Control = True Then e.SuppressKeyPress =
True
End Sub

The the r character does not show up providing that an exception does not
occur. In VS 2005 I am taking advantage of the Application Events so that I
do not have to put Try Catch blocks everywhere.

Private Sub MyApplication_UnhandledException(ByVal sender As Object,
ByVal e As
Microsoft.VisualBasic.ApplicationServices.Unhandle dExceptionEventArgs)
Handles Me.UnhandledException
MsgBox(My.Resources.Error_GeneralMessage & vbNewLine &
e.Exception.Message.ToString, MsgBoxStyle.Critical,
My.Application.Info.ProductName)
e.ExitApplication = False
End Sub

If an exception is thrown, when I press Ctrl + R and extra r will show up in
the textbox. Does anyone know how I could get around this problem? I could
tie Ctrl + R into the Keydown event or KeyPress of the textbox, but I would
like it to work even if it does not have focus. I had a previous post with
regards to global exceptions causing problems during this process and
discovered it was the 3rd party control that I was using that caused the
errors. Using the Microsoft controls fixed these issues but I keep
experencing what I mentioned above. Any help I would greatly appreciate
it... Thanks...
Jul 21 '05 #1
2 2129
Hi Nick,

I created one small application with one text box and one menubar with
shortcut key as Ctrl+R. In my application the extra "r" character is not
appearing in text at the time of pressing shorcut.

"Nick" wrote:
In VS 2003 and VS 2005 beta 2 I am trying to write a simple program. It has
a datagrid and a textbox along with a menubar. There is a command in the
menu bar which is "Run Query" and has the shortcut key of Ctrl + R If I am
typing in my textbox and hit Ctrl + R an extra r character will show up in
the textbox. I decided to then try this in VS 2005 and the same thing
happens. If I include the following,

Private Sub txtQuery_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles txtQuery.KeyDown
If e.KeyCode = Keys.R And e.Control = True Then e.SuppressKeyPress =
True
End Sub

The the r character does not show up providing that an exception does not
occur. In VS 2005 I am taking advantage of the Application Events so that I
do not have to put Try Catch blocks everywhere.

Private Sub MyApplication_UnhandledException(ByVal sender As Object,
ByVal e As
Microsoft.VisualBasic.ApplicationServices.Unhandle dExceptionEventArgs)
Handles Me.UnhandledException
MsgBox(My.Resources.Error_GeneralMessage & vbNewLine &
e.Exception.Message.ToString, MsgBoxStyle.Critical,
My.Application.Info.ProductName)
e.ExitApplication = False
End Sub

If an exception is thrown, when I press Ctrl + R and extra r will show up in
the textbox. Does anyone know how I could get around this problem? I could
tie Ctrl + R into the Keydown event or KeyPress of the textbox, but I would
like it to work even if it does not have focus. I had a previous post with
regards to global exceptions causing problems during this process and
discovered it was the 3rd party control that I was using that caused the
errors. Using the Microsoft controls fixed these issues but I keep
experencing what I mentioned above. Any help I would greatly appreciate
it... Thanks...

Jul 21 '05 #2
Thanks for Ajay's quick response.

Hi Nick,

I also created a same app on my machine. It works fine without showing an
extra 'r' in the text box.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Maurice Mertens | last post by:
Hi, I'm trying to set shortcut keys for textboxes. But what is the best way to do this in VB.NET. In Access it was very simple, just put an "&" sign in the label that belongs to the textbox. But...
11
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These...
2
by: Jim S | last post by:
I am having a problem finding information regarding vb.net allowing you to create shortcut keys for buttons using the CTRL key + function buttons such as F1, F2 etc.. (Ex: Press CTRL+F1 to activate...
5
by: Powerguy | last post by:
Hi, I am trying to allow users to only be able to enter numeric numbers into a textbox. The problem is that I cannot move focus with the tab key even if I allow it as an allowable key stroke. I...
2
by: Nick | last post by:
In VS 2003 and VS 2005 beta 2 I am trying to write a simple program. It has a datagrid and a textbox along with a menubar. There is a command in the menu bar which is "Run Query" and has the...
11
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
3
by: Michel Vanderbeke | last post by:
Hello, I would like to create a textbox with extra properties where I can choose if the textbox may contain only numbers, only letters, both, punctuation marks etc. Can anyone help me with tips...
4
by: Martin.Kunc | last post by:
Hallo all, I need to make an textbox to accept only Cyrilic characters. I couldn't found any solution except enumerate characters for filtering (seems odd). Please has anyone any ideas ? Thank...
0
by: thirunavukarasukm | last post by:
Hai... How to Usercontrols with Shortcut Keys... I am creating one windows apllication.. the apllication contain many form.. in one form i am used one usercontrol(parent control)..
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.