Adding Custom Functions to Your Application
Updated June 5, 2006
Iron Speed Designer V4.0 and later
Calling your custom code functions is an integral part of customizing your application. Custom functions can be used for variety of reasons such as displaying the results of a mathematical calculation and setting certain field values programmatically.
Step1. To add custom functions to your application, create a .cs or .vb file for your code, such as CustomFunctionFile.cs or .vb. Your custom code file contains classes and methods and looks something like:
C#:
namespace myCustomNameSpace
{
public class CustomFunction
{
public static bool myCustomFunction(int a)
{
if ((a < 10))
{
return true;
}
else
{
return false;
}
}
}
}
Visual Basic.NET:
Namespace mynameSpace
Public Class CustomFunction
Public Shared Function myCustomFunction(ByVal a As Integer) As Boolean
If (a < 10) Then
Return True
Else
Return False
End If
End Function
End Class
End Namespace
Step 2: Include your custom code file in your Iron Speed Designer-application in the App_Code folder located in:
<Application Folder>\App_Code
Using Visual Studio .NET to compile your application
If you are using Visual Studio .NET to compile your application, identify the custom code file to Visual Studio .NET. In Visual Studio .NET, select Add, Add Existing Item.
Using CSC or VBC to compile your application
If you are using the CSC or VBC compiler, your custom code file will be automatically compiled as part of your application.
Step 3: Add a declaration at the top of any Safe class file in your application where your custom code function is called.
C#:
using myCustomNameSpace;
Note: myCustomNameSpace is the namespace declared in CustomFunctionFile.cs.
Visual Basic .NET:
Imports mynameSpace.CustomFunction
Note: MyAppvb1 is the application name, mynameSpace is the name space and CustomFunction is the class name in your custom code file, CustomFunctionFile.vb.
Step 4: Call your custom code function in your application page’s safe class.
C#:
myCustomNameSpace.CustomFunction.myCustomFunction(4);
Visual Basic.NET using the Visual Studio .NET compiler:
myCustomFunction(4)