Code sample b (clientsamplevb) – Rockwell Automation FactoryTalk Transaction Manager User Guide User Manual

Page 155

Advertising
background image

B

FactoryTalk Transaction Manager and Microsoft COM+ Objects

155

ctxObject.SetComplete ‘Required

Exit Function

errorhandler:

Get_VB_Sample_Data = 33999

ctxObject.SetAbort ‘Required

Err.Raise vbObjectError, "Error in Get_VB_Sample_Data ",
_

Err.Description

Exit Function

‘ Program Notes:

‘ Note the use of SetComplete and SetAbort methods

‘ of the ctxObject to end the code. SetComplete and

‘ SetAbort indicate to the transaction server to

‘ deactivate the object and whether to commit changes

‘ made by the business code (SetComplete) or throw

‘ away all changes (SetAbort)

‘ The purpose of the arguments (strKeyID – bolData) of

‘ the Get_VB_Sample_Data function is to demonstrate

‘ how to pass data to and from the function. The

‘ strKeyID variable will show a required input, notice

‘ the ByVal keyword. The remaining variables will show

‘ optional variables returned by the function, notice

‘ the Optional and ByRef keywords.

End Function

Code Sample B (ClientSampleVB)

The following code is referenced in the ―Moving the client sample
application‖ procedure.

Option Explicit

Private Sub Command1_Click()

Dim obj As Object

Dim szKey As String

Dim szString As String

‘ Create an instance of the remote component

Advertising