473,385 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2126
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.