Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MaskEdit
Message
From
29/06/1999 08:17:42
 
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00235026
Message ID:
00235147
Views:
25
Thanks Éric, that did the trick.

What I needed is a control that will:
- Accept only numeric values
- Accept percent values (10.45%)
- Accept currency values (1 000.00$)
- Accept date values (31/01/1999)

I tried the regular textbox first, but it doesn't offer any formatting build-in. With your help, I've successfully written a class that will force any text box linked to it to accept only numeric values, but I don't want to write code to handle all the other cases.

Next, I tried the mask edit box, it was doing what I needed, until I tried to assign a value to it that's smaller than it's mask (if mask = "###" and I tried assigning 10 to it with MaskEdit.Text = 10, I would get an error message).

Is there any other control that I can use that will do what I want them to do and is easier to use? I would rather write one line of code than 3 lines for each control...

On another hand, would I be better to bound the controls to the data source instead of writting a routine that will read the data from the table and write it to the controls and another one for the other way around? Would the mask edit box work better in that scenario?

How do you cancel the modifications done by the user if he press the Cancel button?

The user can apply a filter on the table. Would that affect the way the controls are bound?

I'm using DAO BTW.

TIA

>I'm not exactly sure of what you but there is guess!!!
>
>Place a MaskedBox control, a TextBox control and a CommandButton control on a from (without changing any properties). Then paste this code.
>
>Private Sub Command1_Click()
> With MaskEdBox1
> .SelStart = 0
> .SelLength = Len(.FormattedText)
> .SelText = Text1.Text
> End With
>End Sub
>
>Private Sub Form_Load()
> MaskEdBox1.Mask = "###"
>End Sub
>
>Is working as you wish? If not, which part doesn't satisfy your needs?
>
>The Format property is often use with date. IE, you use a mask for the input (like yyyy/mm/dd) and a different format for the display (like dd mmm yyyy).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform