×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Change Text Box decimals

Change Text Box decimals

Change Text Box decimals

(OP)
Could someone tell me how to change the number of decimals to use on mathcad´s control textbox, when I am using a input variable. Maybe using Edit Script? Thanks.

Sergio

RE: Change Text Box decimals

CODE

Sub TextBoxEvent_Start()
  Rem TODO: Add your code here
End Sub

Sub TextBoxEvent_Exec(Inputs,Outputs)
    Value = CDbl(TextBox.Text)
    IntVal = Int(Value)
    Str = Len(IntVal)
    Txt = Left(TextBox.Text,Str+3)
    Outputs(0).Value = CDbl(Txt)
End Sub

Sub TextBoxEvent_Stop()
  Rem TODO: Add your code here
End Sub

I think, this is what you want. Of course, you'll have to change the "+3" to something else. This gives you only two digits after the decimal point.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources