TruncateDecimal property (WinStudio scripts)

Applies To

IWSFormComponent interface

Definition

Sets or returns a Boolean value specifying whether the value of a component is rounded automatically to a set number of decimal places.

Get Syntax

object.TruncateDecimal

  Part   Description
object Required. A component object.

Set Syntax

object.TruncateDecimal = Boolean

Part Description
object Required. A component object.
Boolean Required. Determines whether decimal rounding is enabled or disabled:
  • TRUE: Enables decimal rounding.
  • FALSE: Disables decimal rounding.

Remarks

In the Get syntax, a return value of:

  • TRUE indicates that rounding is enabled.
  • FALSE indicates that rounding is disabled.

Rounds decimal values to the number of decimal places specified by DigitsAfterDecimal. Corresponds to and can be used to programmatically set the Round property on the component property sheet.

Numbers greater than 5 are rounded up.

Example

Sub Main()
   Dim myDecimal As Decimal
   ThisForm.Components("edit1").DigitsAfterDecimal = 4
   ThisForm.Components("edit1").TruncateDecimal = True
   myDecimal = ThisForm.Components("edit1").GetValueOfDecimal(0)
   Application.ShowMessage("Display value: " & myDecimal)
End Sub