473,385 Members | 1,343 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.

TextBoxes and Button Shortcuts

Hello All,

I have a form with some text boxes and buttons. The buttons have shortcuts
in their text labels, such as "&Add". When the user is still focused on the
textbox and presses Alt-A, does that Alt-A code get included with the text
value? It appears to be doing so, and I'm wondering what the best way to
deal with it is?

Each of the text boxes have a _Validating() function something like this:

If IsNumeric(Me.TextBox1.Text) Then
' Validate the text
Else
MsgBox("Invalid Entry")
Me.TextBox1.Focus()
End If

The IsNumeric() is failing, so I can only conclude that Alt-A is being added
to the .Text variable. Is there a way to stop this from happening, or strip
that Alt- code off the end?

Thanks.

- Jason
Nov 21 '05 #1
1 2623
Hi Jason,

I played the scenario that you mentioned and did not face that problem. I
am puzzled as to why it is not working for you.

I have noticed one thing w/ the buttons w/ the shortcut. The shortcut does
not become visible unless you activate it. By this I mean that your "Add"
button does not look like "_Add" till you press "Alt-A" at least once.

Anyways, I am pasting my code below.

\\\
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles button1.Click
Dim txt As String
txt = TextBox1.Text
MsgBox(txt)
'Me.Close()

End Sub

Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal
e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
If IsNumeric(Me.TextBox1.Text) Then
' Validate the text
Else
MsgBox("Invalid Entry")
Me.TextBox1.Focus()
e.Cancel = True
End If

End Sub

\\\

Whenever I press "Alt-C"; the button's shortcut, with the cursor in the
textbox the Messagebox displays the textbox data. I do not get the "invalid
entry" message unless the textbox has alphabets.

HTH
Nov 21 '05 #2

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

Similar topics

2
by: Steveo | last post by:
Hi I have a form containing some text boxes and a button. I'm trying to work out how to make it so that if certain textboxes contain no data then the button is not enabled (however still...
1
by: Bernd Smits | last post by:
Hi, I've a form that is associated to a table, and a few textbox in it. Now when I compile all the textboxes (which each one corrispond to a field of the associated table), and I click on a button...
4
by: Jason M | last post by:
Hi, Im very new to c#, so forgive me if this is a really stupid question. Im trying to create a form for entering purchase requests. For each line item I have a quantity, a description unit cost...
0
by: Nathan Sokalski | last post by:
I am making a webform that allows the user to add another textbox by clicking a button to allow them to enter however many names they need. The procedure that does this uses information entered in...
0
by: H. Blijlevens | last post by:
I've been debugging an application of a former colleague, and some things aren't working as they are supposed to. It's an MDI based application with 1 empty MDI Child Form as a template. For each...
1
by: kari | last post by:
Hi, I've already set the ShortcutsEnabled property to true but still cannot use keyboard shortcuts to do "copy", "cut", "paste" ,"select all", "undo" , "redo", etc. Did I miss anything?
3
by: AlanM | last post by:
I have asp.net page with a asp:table in the page load function I build the table with stock items from a database with some textboxes to enter amounts into. By pressing a button the user can then...
3
by: sakhan | last post by:
Hello Friends, I want to create a row of 10 textboxes each time I click the add button. I want this to continue till it reaches five hundred I am using AJAX for this. It doesnot create 10...
4
by: =?Utf-8?B?QWxCcnVBbg==?= | last post by:
I have a form with some textboxes and a button. I'd like for the button to be disabled until the user enters valid data in either of two of the textboxes, but can't quite seem to figure out how to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.