
I often work with FormControls and need to understand the type of control in order to use the right properties and methods.
The code below shows how to intercept the control type and cast it with the matching type
public void getFormControlType(FormControl _myFormControl)
{
FormRealControl callingRealControl;
FormStringControl callingStringControl;
FormIntControl callingIntControl;
FormInt64Control callingInt64Control;
FormDateControl callingDateControl;
switch (_myFormControl.handle())
{
case classNum(FormRealControl):
callingRealControl = _myFormControl; //This is a real type
callingRealControl..... //Insert your code here
break;
case classNum(FormStringControl):
callingStringControl = _myFormControl; //This is a String type
callingStringControl.....//Insert your code here
break;
case classNum(FormIntControl):
callingIntControl = _myFormControl; //This is an Int type
callingIntControl.....//Insert your code here
break;
case classNum(FormInt64Control):
callingInt64Control = _myFormControl; //This is an Int64 type
callingInt64Control.....//Insert your code here
break;
case classNum(FormDateControl):
callingDateControl = _myFormControl; //This is a Date type
callingDateControl.....//Insert your code here
break;
}
}