Creates a Delegate of the specified type for the specified script function.
Namespace: Ico.GwxAssembly: GwxRuntimeCore (in GwxRuntimeCore.dll) Version: 10.97.212.0 (10.97.212.00)
Syntax
| C# |
|---|
public Delegate CreateDelegate( Type delegateType, Object functionOwner, string functionName ) |
| Visual Basic |
|---|
Public Function CreateDelegate ( _ delegateType As Type, _ functionOwner As Object, _ functionName As String _ ) As Delegate |
| JScript |
|---|
public function CreateDelegate( delegateType : Type, functionOwner : Object, functionName : String ) : Delegate |
Parameters
- delegateType
- Type: System..::..Type
The type of delegate to create.
- functionOwner
- Type: System..::..Object
The object that owns the script function to invoke.
- functionName
- Type: System..::..String
The name of the script function that the delegate invokes.
Return Value
A delegate, or null if a delegate cannot be created.
Examples
This example shows how to use the CreateDelegate function in JScript.NET.
CopyC#
function Button1_Click(sender : System.Object, e : System.Windows.RoutedEventArgs)
{
var o : System.Windows.Controls.Button = System.Windows.Controls.Button(ThisConfiguration.GetObjectByName("Button2").ToDependencyObject());
o.add_Click(ThisDocument.CreateDelegate(System.Windows.RoutedEventHandler, this, "Button2_Click"));
}
function Button2_Click(sender : System.Object, e : System.Windows.RoutedEventArgs)
{
System.Windows.MessageBox.Show("Click2");
}