ComponentOne Sizer 8.0
Creating a Calculated Text Box

You can use the C1Awk's expression evaluator to create user-friendly data entry controls such as calculated text boxes.

Your users will certainly appreciate being able to type "1234.23*0.085=" in a "Sales Tax" text box instead of having to use a calculator.

The following code replaces expressions with their values whenever the user hits the equals ("=") key:

Example Title
Copy Code
  Sub Text1_KeyPress(KeyAscii as Integer)

    If KeyAscii = Asc ("=") Then

      v = awk.Eval(Text1)

      If awk.Error = 0 then

        Text1 = Format(v)

      Else

        Beep

      End If

      KeyAscii = 0

    End If

  Exit Sub

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback