import com.ibm.form.api.DTK;
import com.ibm.form.api.xfdl.FormNodeP;
import com.ibm.form.api.xfdl.XFDL;
import com.ibm.form.api.error.UWIException;
import com.ibm.form.api.IFSSingleton;
public class CalculateAge
{
private static FormNodeP theForm;
public static void main(String argv[])
{
int birthYear;
int birthMonth;
int birthDay;
try
{
initialize();
loadForm();
birthYear = getBirthYear();
birthMonth = getBirthMonth();
birthDay = getBirthDay();
setBirthYear(birthYear);
setBirthMonth(birthMonth);
setBirthDay(birthDay);
saveForm();
theForm.destroy();
}
catch (Exception ex)
{
ex.printStackTrace();
}
/* Additional code removed */
}
}
To add this to your Visual Basic Project, open the References ; dialog from the Project menu and select “InternetForms API”.
' Create the Main method for the program.
Sub Main()
' Declare a number of variables. TheForm represents the form, while the
' other variables are values we will read from the form.
Dim TheForm As IFormNodeP
Dim BirthYear As Integer
Dim BirthMonth As Integer
Dim BirthDay As Integer
' The program's Main consists of a number of calls to other functions.
Initialize
Set TheForm = LoadForm
BirthYear = GetBirthYear(TheForm)
BirthMonth = GetBirthMonth(TheForm)
BirthDay = GetBirthDay(TheForm)
SetBirthYear BirthYear, TheForm
SetBirthMonth BirthMonth, TheForm
SetBirthDay BirthDay, TheForm
SaveForm TheForm
' Free the memory in which the form was stored.
TheForm.Destroy
End Sub