472,779 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 2095
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.