PostEvent method (WinStudio scripts)

Applies To

IWSForm interface

Definition

Generates a standard event or a customized event as the last event for the specified form.

Syntax

object.PostEvent( string )

  Part   Description
object Required. The name of a valid form object.
string Required. The name of the event.

Example

The following script generates a form event to run an appropriate report based on a selection.

 Sub Main()
    Dim Selection As String 
    On Error GoTo ErrorHandler
    Application.DiagnosticsLog("entering script")
    ReturnValue = "1"
    Selection = GetParameter(0)
    Application.DiagnosticsLog("Selection= " & Selection)
    Select Case Selection
    Case "1"
         ThisForm.PostEvent("ReportByBank")
    Case "2"
         ThisForm.PostEvent("ReportByCustomer")
    Case "3"
         ThisForm.PostEvent("ReportByAccountSet")
    Case Else
         GoTo ErrorExit
    End Select
    GoTo NormalExit
    NormalExit:
    Application.DiagnosticsLog("exiting script normally")
    ReturnValue = "0"
    Exit Sub
    ErrorExit:
    Application.DiagnosticsLog("exiting script via ErrorExit")
    ReturnValue = "1"
    Exit Sub
    ErrorHandler:
    Application.ShowMessage(Err.Description)
    ReturnValue = "1"
    Exit Sub
End Sub