Case 2 - Visual Basic - Code
Option Explicit
Public Session As LANSA_ACTIVEX_LIB.Session
Public gbDirty As Boolean
Private Sub cmdShowEmployee_Click()
Call AXPANELA.uShowEmployeeSkills(uEmployeeNumber, gbDirty)
If gbDirty = True Then
sbcase2.SimpleText = "No skills found for employee"
Else:
sbcase2.SimpleText = " Employee skills selected"
End If
End Sub
Private Sub Form_Load()
' login to LANSA using default user, password and session location
If Session Is Nothing Then
Call ConnectToLansa("<user name>", "<password>", "<session.cfg path>")
End If
Call Session.AddComponent(AXPANELA.object)
End Sub
Private Sub ConnectToLansa(ByVal username As String, ByVal password As String, ByVal txtlocation As String)
On Error GoTo ErrorHandler
Set Session = New LANSA_ACTIVEX_LIB.Session
' Set the session configuration file
Session.ConfigFile = txtlocation
Call Session.SetConnectParam("USER", username)
Call Session.SetConnectParam("PSPW", password)
Call Session.Connect
Exit Sub ' Exit to avoid handler.
ErrorHandler: ' Error-handling routine.
MsgBox ("Error :" + Err.Description)
End Sub