473,385 Members | 2,015 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.

Data Entry Control

Do anyone know how to evaluate each character a user
enters to determine if it is numeric? I don't want to
let the user type in an alpha character. If they hit a
alpha character I want the computer to beep but retain
the numbers they already typed in.

Your help is appreciated
Nov 20 '05 #1
6 1553
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar.IsNumber(e.KeyChar) Then

MsgBox("Numeric")

End If

End Sub

Regards - OHM

Christopher Brandy wrote:
Do anyone know how to evaluate each character a user
enters to determine if it is numeric? I don't want to
let the user type in an alpha character. If they hit a
alpha character I want the computer to beep but retain
the numbers they already typed in.

Your help is appreciated


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #2
What if it's not numeric? How do I not add that
character to the textbox. In VB6, I just set the key
code to 0.
-----Original Message-----
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar.IsNumber(e.KeyChar) Then

MsgBox("Numeric")

End If

End Sub

Regards - OHM

Christopher Brandy wrote:
Do anyone know how to evaluate each character a user
enters to determine if it is numeric? I don't want to
let the user type in an alpha character. If they hit a
alpha character I want the computer to beep but retain
the numbers they already typed in.

Your help is appreciated


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.

Nov 20 '05 #3
Else
e.Handled=True

End If

Regards - OHM
Christopher Brandy wrote:
What if it's not numeric? How do I not add that
character to the textbox. In VB6, I just set the key
code to 0.
-----Original Message-----
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar.IsNumber(e.KeyChar) Then

MsgBox("Numeric")

End If

End Sub

Regards - OHM

Christopher Brandy wrote:
Do anyone know how to evaluate each character a user
enters to determine if it is numeric? I don't want to
let the user type in an alpha character. If they hit a
alpha character I want the computer to beep but retain
the numbers they already typed in.

Your help is appreciated


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #4
I'm afraid this does not work. The alpha character is
still added to the textbox. Any other suggestions?
-----Original Message-----
Else
e.Handled=True

End If

Regards - OHM
Christopher Brandy wrote:
What if it's not numeric? How do I not add that
character to the textbox. In VB6, I just set the key
code to 0.
-----Original Message-----
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar.IsNumber(e.KeyChar) Then

MsgBox("Numeric")

End If

End Sub

Regards - OHM

Christopher Brandy wrote:
Do anyone know how to evaluate each character a user
enters to determine if it is numeric? I don't want to let the user type in an alpha character. If they hit a alpha character I want the computer to beep but retain the numbers they already typed in.

Your help is appreciated

--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.

Nov 20 '05 #5
It does work. Look at this NOTE ( KEY PRESS EVENT ). I Just tested it

OHM

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

If Char.IsNumber(e.KeyChar) Then

'Do nothing

Else

e.Handled = True

End If

End Sub



Chris wrote:
I'm afraid this does not work. The alpha character is
still added to the textbox. Any other suggestions?
-----Original Message-----
Else
e.Handled=True

End If

Regards - OHM
Christopher Brandy wrote:
What if it's not numeric? How do I not add that
character to the textbox. In VB6, I just set the key
code to 0.

-----Original Message-----
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar.IsNumber(e.KeyChar) Then

MsgBox("Numeric")

End If

End Sub

Regards - OHM

Christopher Brandy wrote:
> Do anyone know how to evaluate each character a user
> enters to determine if it is numeric? I don't want to
> let the user type in an alpha character. If they hit a
> alpha character I want the computer to beep but retain
> the numbers they already typed in.
>
> Your help is appreciated

--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #6
OK, Call me crazy. It works. Sorry and thanks a bunch.
-----Original Message-----
I'm afraid this does not work. The alpha character is
still added to the textbox. Any other suggestions?
-----Original Message-----
Else
e.Handled=True

End If

Regards - OHM
Christopher Brandy wrote:
What if it's not numeric? How do I not add that
character to the textbox. In VB6, I just set the key
code to 0.

-----Original Message-----
Private Sub TextBox1_KeyPress(ByVal sender As
Object,
ByVal e As System.Windows.Forms.KeyPressEventArgs) HandlesTextBox1.KeyPress If e.KeyChar.IsNumber(e.KeyChar) Then

MsgBox("Numeric")

End If

End Sub

Regards - OHM

Christopher Brandy wrote:
> Do anyone know how to evaluate each character a user
> enters to determine if it is numeric? I don't wantto> let the user type in an alpha character. If theyhit a> alpha character I want the computer to beep butretain> the numbers they already typed in.
>
> Your help is appreciated

--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
.

.

Nov 20 '05 #7

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

Similar topics

12
by: Nhmiller | last post by:
When I start to type the data for a new record, I would like a dropdown box to open next to it from which I can choose the data from a previously entered record that starts with the same letter....
1
by: Trent | last post by:
I am in the design phase of a new database and am having a devil of a time with a subform. I have three tables that relate to problem - Suppliers tbl, Customers tbl and a SuppliersCustomers tbl....
1
by: panche | last post by:
I'm developing a fairly simple user control that has two textboxes for date/time entry (a from date/time and a to date/time). One of my requirements is that there should be no button that sets...
2
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the...
4
by: Lloyd Dupont | last post by:
On my web page I have a custom control developed in a C# library. Somehow when I post the page, the user input disappears. I override OnLoad() and check the value of my inputText.Text just before...
2
by: Sethos | last post by:
I am sure that this has been covered, hashed, and rehashed, but a search on the group did not produce the answer, so forgive me if this seems like a "newbie" type question... Besically, I have a...
2
by: Adam Honek | last post by:
I have a form. It has serveral text boxes for user data entry. I could of course write code to check if each is empty before proceeding to save this data to a file. Is there any global way...
20
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an...
0
by: =?Utf-8?B?bW9oYW5yYWpfaw==?= | last post by:
Hi, how can we select the day/month/year component in a DateTimePicker control, while navigating between fields. i.e, when i gotfocus to the control, either day/month/year component to be...
2
by: eighthman11 | last post by:
Hello everyone, I'm using Access 2000 and SQL 8.0 This maybe easy but I can't figure it out. I have a linked access table to a SQL server table. I use this table on a Grid on an Access form. ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.