473,399 Members | 3,302 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,399 software developers and data experts.

Adding a input mask

I need to allow only numbers into a text box

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------
Nov 20 '05 #1
15 1368
In the KeyPress EventDim ch As String

ch = Chr$(KeyAscii)
If Not (ch >= "0" And ch <= "9") Then
' Cancel
KeyAscii = 0
End IfRegards - OHM#Crirus wrote:
I need to allow only numbers into a text box


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #2
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> schrieb
In the KeyPress EventDim ch As String

ch = Chr$(KeyAscii)
If Not (ch >= "0" And ch <= "9") Then
' Cancel
KeyAscii = 0
End IfRegards - OHM#Crirus wrote:
I need to allow only numbers into a text box


Regards - OHM# On**********@BTInternet.com


How to suppress inserting chars from the clipboard? ;-)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Hey, I cant write everything from scratch each time, I am after all One
Handed Man.

;-)

Regards - OHM#
Armin Zingler wrote:
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> schrieb
In the KeyPress EventDim ch As String

ch = Chr$(KeyAscii)
If Not (ch >= "0" And ch <= "9") Then
' Cancel
KeyAscii = 0
End IfRegards - OHM#Crirus wrote:
I need to allow only numbers into a text box


Regards - OHM# On**********@BTInternet.com


How to suppress inserting chars from the clipboard? ;-)


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #4
I sow some sample of input mask so the text box dont consider any character
that dont fit the mask..but lost it

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hey, I cant write everything from scratch each time, I am after all One
Handed Man.

;-)

Regards - OHM#
Armin Zingler wrote:
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> schrieb
In the KeyPress EventDim ch As String

ch = Chr$(KeyAscii)
If Not (ch >= "0" And ch <= "9") Then
' Cancel
KeyAscii = 0
End IfRegards - OHM#Crirus wrote:
I need to allow only numbers into a text box

Regards - OHM# On**********@BTInternet.com


How to suppress inserting chars from the clipboard? ;-)


Regards - OHM# On**********@BTInternet.com

Nov 20 '05 #5
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> schrieb
Hey, I cant write everything from scratch each time, I am after all
One Handed Man.

;-)


Yes, I also wondered where it has been asked and answered the last time. :)
--
Armin

Nov 20 '05 #6
Cor
Hi Armin,
How to suppress inserting chars from the clipboard? ;-) (saw it, but also

know it)

That you can do with a isnumeric and a leave.

I hope this helps you?

:-)))))

Cor
Nov 20 '05 #7
Any straight answer?
I need another inputs restrictions too, not only numeric

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Crirus" <Cr****@datagroup.ro> wrote in message
news:e1**************@TK2MSFTNGP12.phx.gbl...
I need to allow only numbers into a text box

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

Nov 20 '05 #8
Cor
Hi Crirus,

As addition from the sample of OHM this sample.
And watch that you add with the sample of OHM the allowance of the backspace
08 keyvalue other wise the user cannot make corrections)

You can in both samples of course use any character you want to exclude.
Although this is a value sample.

Cor
\\\
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.textbox1.MaxLength = 2
End Sub
Private Sub textbox1_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles textbox1.KeyUp
If e.KeyValue <> 8 Then
If Not IsNumeric(textbox1.Text) OrElse CInt(textbox1.Text) = 0 _
OrElse CInt(textbox1.Text) > 10 Then
MessageBox.Show("Only 1 to 10 is allowed")
textbox1.Focus()
End If
End If
End Sub
///
Nov 20 '05 #9
I think its time we got paid for this Cor, he's probably earning $150 per
hour and they think he's writing it all himself !!!

;-)

Regards - OHM#

Cor wrote:
Hi Crirus,

As addition from the sample of OHM this sample.
And watch that you add with the sample of OHM the allowance of the
backspace 08 keyvalue other wise the user cannot make corrections)

You can in both samples of course use any character you want to
exclude. Although this is a value sample.

Cor
\\\
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.textbox1.MaxLength = 2
End Sub
Private Sub textbox1_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles textbox1.KeyUp
If e.KeyValue <> 8 Then
If Not IsNumeric(textbox1.Text) OrElse CInt(textbox1.Text)
= 0 _ OrElse CInt(textbox1.Text) > 10 Then
MessageBox.Show("Only 1 to 10 is allowed")
textbox1.Focus()
End If
End If
End Sub
///


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #10
"Crirus" <Cr****@datagroup.ro> schrieb
Any straight answer?
I need another inputs restrictions too, not only numeric


I would not restrict the input. I'd check the correct format in the validate
event (or wherever you need the value latest), usually by trying to convert
it to the destination data type (e.g. Decimal.Parse) and catching thrown
exceptions, or by calling a function like Double.TryParse.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #11
LOL

First, I earn 5$ per hour. (EEST, you know)
Second this is my particular project for a Internet Tick Based game that you
probably whould like to play it for free sometime in the future :)

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I think its time we got paid for this Cor, he's probably earning $150 per
hour and they think he's writing it all himself !!!

;-)

Regards - OHM#

Cor wrote:
Hi Crirus,

As addition from the sample of OHM this sample.
And watch that you add with the sample of OHM the allowance of the
backspace 08 keyvalue other wise the user cannot make corrections)

You can in both samples of course use any character you want to
exclude. Although this is a value sample.

Cor
\\\
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.textbox1.MaxLength = 2
End Sub
Private Sub textbox1_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles textbox1.KeyUp
If e.KeyValue <> 8 Then
If Not IsNumeric(textbox1.Text) OrElse CInt(textbox1.Text)
= 0 _ OrElse CInt(textbox1.Text) > 10 Then
MessageBox.Show("Only 1 to 10 is allowed")
textbox1.Focus()
End If
End If
End Sub
///


Regards - OHM# On**********@BTInternet.com

Nov 20 '05 #12
And I know how to restrict with code the input, but I cant remember one
sample tat use a string as a mask and I'm crazy about using that way

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I think its time we got paid for this Cor, he's probably earning $150 per
hour and they think he's writing it all himself !!!

;-)

Regards - OHM#

Cor wrote:
Hi Crirus,

As addition from the sample of OHM this sample.
And watch that you add with the sample of OHM the allowance of the
backspace 08 keyvalue other wise the user cannot make corrections)

You can in both samples of course use any character you want to
exclude. Although this is a value sample.

Cor
\\\
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.textbox1.MaxLength = 2
End Sub
Private Sub textbox1_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles textbox1.KeyUp
If e.KeyValue <> 8 Then
If Not IsNumeric(textbox1.Text) OrElse CInt(textbox1.Text)
= 0 _ OrElse CInt(textbox1.Text) > 10 Then
MessageBox.Show("Only 1 to 10 is allowed")
textbox1.Focus()
End If
End If
End Sub
///


Regards - OHM# On**********@BTInternet.com

Nov 20 '05 #13
Cor
Hi Crirus,

I think you can do that with the sample I did send you.

When I say textbox > 10 you also can check it against any regular
expression in my opinion.

But as far as I know there is no standard property that does that for you
(and when you make a custom textbox you do the same again).

Cor
Nov 20 '05 #14
Right now I found MaskedEdit control ocx on google... there is one in NET?

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Cor" <no*@non.com> wrote in message
news:uq**************@TK2MSFTNGP12.phx.gbl...
Hi Crirus,

I think you can do that with the sample I did send you.

When I say textbox > 10 you also can check it against any regular
expression in my opinion.

But as far as I know there is no standard property that does that for you
(and when you make a custom textbox you do the same again).

Cor

Nov 20 '05 #15
On Fri, 12 Dec 2003 14:12:30 +0200, Crirus wrote:
Right now I found MaskedEdit control ocx on google... there is one in NET?


If you download the VB.Net Resource kit, it includes ComponentOne suite of
controls and the textbox in that has a good masked edit property.
--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #16

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

Similar topics

6
by: dude | last post by:
hello how would i make an input mask that only makes the first letter a capitol one? i've been playing around and testing various masks, also tried the wizard, but i've had no luck. could...
2
by: Ellen Manning | last post by:
I've got an A2K database with a link to a table in another A2K database. This linked table contains SSN formatted with the SSN input mask. I'm trying to use a dlookup using this linked table. ...
9
by: Paul | last post by:
hi, is there an input mask i could use on a report to do the following: (1) if i enter "THISISATEST" on my form, i want the text box on my report to display: "T H I S I S A T E S T". (2) if...
2
by: johnp | last post by:
Hi, Our Tech department updated users to Office 2003 this week. Now the input mask in one of the applications is showing up as: (###) ###-### The input mask wizard works correctly when I...
7
by: F. Michael Miller | last post by:
I have a db with Access front end, sql back, linked tables. I need to be able to change input masks at the table level in code. Any ideas? Thanks!
3
by: AA Arens | last post by:
When I want the first character of a field to be Uppercased, I need to make an input mask, like >L< followed by ??????? for example. But this mask creates ____ in an unfilled field, which I don't...
9
by: msnews.microsoft.com | last post by:
Hello. How can I set input mask for TextBox? Or can I use for mask input some other control?
1
ADezii
by: ADezii | last post by:
The following characters define an Input Mask: Character - Description 0 - Digit (0 to 9, entry required, plus and minus signs not allowed). 9 - Digit or space (entry not required, plus...
7
desklamp
by: desklamp | last post by:
I'm a total Access newbie, please bear with me! Using Win2K/Access 2003. I'm trying to create a table in which I can store IP addresses and other information. According to Microsoft, there is no...
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: 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
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: 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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...

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.