PC Review


Reply
Thread Tools Rate Thread

Adding a input mask

 
 
Crirus
Guest
Posts: n/a
 
      12th Dec 2003
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

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


 
Reply With Quote
 
 
 
 
One Handed Man [ OHM# ]
Guest
Posts: n/a
 
      12th Dec 2003
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# (E-Mail Removed)


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Dec 2003
"One Handed Man [ OHM# ]" <(E-Mail Removed)> 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# (E-Mail Removed)


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


--
Armin

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

 
Reply With Quote
 
One Handed Man [ OHM# ]
Guest
Posts: n/a
 
      12th Dec 2003
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# ]" <(E-Mail Removed)> 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# (E-Mail Removed)

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


Regards - OHM# (E-Mail Removed)


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Dec 2003
"One Handed Man [ OHM# ]" <(E-Mail Removed)> 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

 
Reply With Quote
 
Crirus
Guest
Posts: n/a
 
      12th Dec 2003
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# ]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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# ]" <(E-Mail Removed)> 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# (E-Mail Removed)

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

>
> Regards - OHM# (E-Mail Removed)
>
>



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      12th Dec 2003
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


 
Reply With Quote
 
Crirus
Guest
Posts: n/a
 
      12th Dec 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> ------------------------------
>
>



 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Dec 2003
"Crirus" <(E-Mail Removed)> 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

 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      12th Dec 2003
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
///


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete a custom mask from the Input Mask Wizard johnsweet Microsoft Access 1 14th Feb 2010 08:04 PM
Input mask for text box to enforce numeric input and right adjust. ThomasAJ Microsoft Access Form Coding 0 27th Feb 2009 09:26 AM
Input mask date syntax-limit input to a number range =?Utf-8?B?QmlsbGlhbQ==?= Microsoft Access Database Table Design 2 18th Nov 2007 03:37 PM
Input Mask and Adding Century Prefix for Year =?Utf-8?B?UmljaDEyMzQ=?= Microsoft Access Forms 2 29th Sep 2005 03:25 PM
Input Mask box / Input Mask Wizard Deb Schipper Microsoft Access Database Table Design 1 22nd Sep 2003 12:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:32 AM.