|
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-generated application.
For .NET Framework 1.1, place the .cs or .vb file in any folder that is part of your application.
For .NET Framework 2.0, the file must be placed 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#:
Note: myCustomNameSpace is the namespace declared in CustomFunctionFile.cs.
Visual Basic .NET, .NET Framework 1.1:
|
Imports MyAppvb1.mynameSpace.CustomFunction
|
Visual Basic .NET, .NET Framework 2.0:
|
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:
Visual Basic .NET, .NET Framework 1.1 using the VBC compiler:
|
mynameSpace.CustomFunction.myCustomFunction(4)
|
myCustomNameSpace is the name space, CustomFunction is the name of the class and
myCustomFunction is the method defined in the CustomFunctionFile.cs.
|