martin2k

Google
 
Web www.martin2k.co.uk

input mask for text box


Home Read and add posts to the Visual Basic 6.0 Forums Download some of my programs and OCXs Read the Tips here The old style forum is still available here Contact

Back


From: Pam (alias 'DumbNewbie') E-mail: aandpparker@aol.com 1

Date: Wednesday, April 25, 2001 at 00:31:20

Subject: input mask for text box

Comments:

hiya Martin

Thanks for your last tip - I incorporated it into my application, great!

Hope you don't mind another question!

I have several input boxes on my form which require the user to enter currency.

At present, user can enter any data type in these fields. What I really want is for the application to inform user of incorrect data type and undo any input entered into field, thus forcing the user to input currency.

Text boxes concerned are named: 

TxtLoanAmt
TxtIncome 
TxtOutgoings

How can I do this?

Thanks in anticipation and kind regards - Pam

GMT : 00:30 Wednesday 25/4/01

From: Martin Allen E-mail: <No e-mail> 2

Date: Sunday, April 29, 2001 at 17:14:28

Subject: RE: input mask for text box

Comments:

I have tried this in a program before and I could not do it.

This is my second attempt, which does not work that well.  If anyone knows how to do this properly, please reply to this message.

Private Sub TxtLoanAmt_Change()
    If TxtLoanAmt.Text= "" Then Exit Sub

    If IsNumeric(TxtLoanAmt.Text) = False Then
        TxtLoanAmt.Text= "£0.00"
        TxtLoanAmt.SelStart= 1
    Else
        TxtLoanAmt.Text= "£" & Replace(TxtLoanAmt.Text,"£", "")
    End If
End Sub


This forum is no longer taking new messages or replies since 01 November 2002.  The above material is for reference purposes only.

The new Visual Basic 6.0 forum can be found here.


Martin Allen 1999 - 2003.  Last updated Monday 12 May 2003 07:58:53 PM +0100.