RegisterObject

Description

Registers the PowerBuilder object. After registration, the event in the PowerBuilder object can be triggered by the PowerBuilder.RegisteredObject.TriggerEvent method in the .NET assembly. The event to be triggered by .NET assembly must be a custom event that can have only one string-type parameter or no parameter, with one string-type return value or no return value. For details, refer to Triggering PowerScript events from C# code in Application Techniques.

Applies to

DotNetObject

Syntax

Integer RegisterObject(readonly string objectname, PowerObject obj) 

Argument

Description

objectname

The name to be registered with the object. The user event in the registered object can be triggered by .NET assembly. The object name is case-sensitive.

obj

The PowerBuilder object to be registered.


Return value

Integer.

Returns values as follows. If any argument's value is null, the method returns null.

1 -- Success.

-1 -- Unknown error.

-5 -- DotNetObject is not instantiated.

-50 -- PowerObject is not instantiated.

-51 -- The objectname is already registered.

Examples

This statement registers the object w_dotnettest and returns an error if registration failed.

ll_return = lcs_object.RegisterObject("w_dotnettest", w_dotnettest)
if ll_return <> 1 then
   MessageBox("Error", "RegisterObject w_dotnettest failed") 
end if

See also

GetContextService

PostEvent

TriggerEvent

PowerBuilder.RegisteredObject.TriggerEvent (.NET method)

UnregisterObject