Link to home
Start Free TrialLog in
Avatar of parduz
parduz

asked on

Input Format

I have a lot of textboxes for data input.
According with the user choice, i can input in the textbox values in millimeters (and this is not hte problem) or in inches, in the format:
"3/8" or
"1" or
"2 13/32" (this are only example).
Then i must convert this values in mm.
How to "force" this Inches input method?



Avatar of Erick37
Erick37
Flag of United States of America image

Use a Masked Edit Box instead of a TextBox to force a particular format:

mskInput.Mask = "### ##/##" 'Using inches and fraction

mskInput.Mask = "" 'Using any input
Avatar of manojamin
manojamin

I don't think you can force that! If you decide to let the user provide input in inches, it is hard to distinguish that from mm or cm or foot or for that matter any other matric/british numeric input. All you can do is prevent the user entering any character but the numeric, ., and /

If the user selects the input method in inches and enters (300, thinking this as mm) it will be treated as 300 inches not mm! how can you predict users behaviour???

I am curious to know...
Avatar of parduz

ASKER

Erick37:
i can use only "standard" control in this app, so I dont need OCX install.

manojamin:
1) Whats a name! ;)
2) if the user select the English measure system (inches, feets, ...)
and put a value thinking in mm, what can i make? He must be coherent with the choice he makes!
I only ask a method (function) to "understand" that strings like "1 3/8", "2", "5/16" are good to convert in mm and a string like "/3", "3 1" or somewhat else are no good.
use instr(number, "/")
this will tell you if there's a / in there, assuming you will always have something like '1 3/4"'
playing with the user interface can lead to simple soulution for you and for the user as well :

1. first control will be a combobox that
   the user will have to select between
   'mm' or 'inch' . set one of this
   2 to be the default.

2. the values will be inserted into 2
   textboxes. one for 'full Units' and
   the other for 'remainings'.
 
3. having the combobox value will make it simpler to calculate the rest.
ASKER CERTIFIED SOLUTION
Avatar of manojamin
manojamin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of parduz

ASKER

BINGO!

Full working code, and fast answer.
What can i ask more?

Thanks!!!