What are Code Modules?
Code modules provide for global functions which can be called from other code blocks within the K2.net process.
Page 1 / 1
Code Modules are additional classes, that can be referenced from anywhere within the Project. They are developed in the same language as what the project is set for (C# or VB.NET). Included below are 2 samples of code modules, with their associated calling code.
VB Code Module:
VB Server Event Referencing Code Module:
C# Code Module:
C# Server Event Referencing Code Module:
VB Code Module:
Public Class CM001
Sub Main(ByVal Msg As String)
Console.WriteLine(Msg)
End Sub
End Class
VB Server Event Referencing Code Module:
Sub Main(K2 as Object)
K2.Synchronous = True
Dim O As New CM001()
O.Main("CM001 Class called.")
End Sub
C# Code Module:
public class CM001 {
public string Main(string Msg) {
return Msg;
}
}
C# Server Event Referencing Code Module:
public void Main(ServerEventContext K2)
{
K2.Synchronous = true;
CM001 CM = new CM001();
Console.WriteLine(CM.Main("This is the Message."));
}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.