Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MaskEdit
Message
 
To
29/06/1999 08:17:42
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00235026
Message ID:
00235328
Views:
25
>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)

For date input, have you tried the date time picker (if you installed VB6!).

For other, I never use the maskedit control because it is sluggish!!! I normally use a regular textbox with validation rules which is included in an ActiveX Control of our own.

>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.

Build your own ActiveX control.

>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).

With my sample of yesterday I had no problem (do you use .Text or .SelText?).

>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...

A real good one that I know is Input Pro from FarPoint (http://www.fpoint.com/).

>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?

I never had real good experiences with the binding (except for grid or the like). I had always switch to manually feeding the controls.

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

If you are bind, I think that a Move(0) method will correct your problem.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform