Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading characters

Status
Not open for further replies.

codenovice

IS-IT--Management
Dec 4, 2001
11
US
I am using an Input box to get a number in the form 91234.43567

After I get this I need to make this calc:
9 + 12/60 + 34/3600 + 43567

Please help me and how do I restrict the input i.e I need 5 inputs from the user and after that the focus shoul;d shift to calculate button and if the user does not enetr anything then generate ERROR message


Thanks
codenovice
 
Are you going to enter using five text field or one.

If one you can break the text into diff values.

dim lng1 as long
dim lng2 as long
dim lng3 as long
dim lng3 as long
dim lngTot as long

lng1 = val(mid(text, 1, 1))
lng2 = val(mid(text, 2, 2))
lng3 = val(mid(text, 4, 2))
lng4 = val(mid(text, 7, 4))

'mid works as (text, start pos, length)

then calculate after getting and validating all you
long fields.

lngTot = lng1 + (lng2 / 60) + (lng3 / 3600) + lng4

as far as setting the focus to a caculate button, set the tab index in the text fields and button in the order needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top