Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Add code to the application Close event – PB Docs 2021 – PowerBuilder Library

Add code to the application Close event – PB Docs 2021

Add
code to the application Close event

Because the connection service manager was called by a global
variable, it is still available to the application and does not need to
be instantiated again (as it would if you had used a local
variable).

Now you call the connection service manager disconnect function to
close the database connection.

  1. Double-click the pbtutor application icon in the System
    Tree.

    The Application painter displays different views of the
    tutorial application object. The Script view is part of a stack in
    the default layout, but you might find it easier to detach it from
    the stack or open a second Script view.

  2. Select close ( ) returns (none) in the second drop-down list
    box of the Script view.

    There is no code yet for the application Close event.

  3. Type the following lines for the Close event comment:

  4. Select all or part of the lines you just added.

    Click the Comment button.

  5. Type the following line below the comment you typed (you can
    use AutoScript to complete the variable name and the function
    name):

    appscr3.gif

    Releasing memory by setting global variables to
    null

    If this were not the application Close event and you no
    longer needed an instance of the global connection variable, you
    could release the memory it occupies by calling the SetNull
    function.

    PowerBuilder also provides a DESTROY statement to destroy
    object instances. Do not use the DESTROY statement for local or
    global variables for nonvisual objects. PowerBuilder garbage
    collection removes any local variables that go out of scope.

  6. Right-click anywhere in the script area of the Script
    view.

    Click Compile in the pop-up menu.

    PowerBuilder compiles the Close script. If you get an error
    message, look carefully at the lines you typed to make sure there is
    no mistyped variable or object name.

  7. Click the Close button in PainterBar1.

    A message box asks if you want to save your changes to the
    Application object in the application library file.

  8. Click Yes.

    This saves your changes and closes the Application
    painter.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x