Running on macOS 10.12.6, Xojo 2017 r2.1
When a session starts, I want to collect some of the session info and write it to a log file. In the Session Open Event Handler I call a public method (GetSessionInfo) also in the Session object. This method then calls a shared method attached to a class that defines the session. The class is defined in a module called mClasses.
(how imaginative, right?)
[code]Public Sub GetSessionInfo()
dim oSession As mClasses.clsSession
dim drSession As new DatabaseRecord
oSession = new mClasses.clsSession
oSession = mClasses.clsSession.CreateSessionObject //this line generates the compile error
'drSession.DateColumn(“SessionStart”) = oSession.SessionStart
'drSession.Column(“SessionID”) = oSession.ID
'drSession.Column(“Account”) = oSession.Account
'drSession.DateColumn(“SessionEnd”) = Nil
'Session.dbSQL.InsertRecord(“SessionLog”, drSession)
End Sub
[/code]
Then the shared method on the clsSession class is
[code]Public Shared Function CreateSessionObject() as Object
Dim oSession As mClasses.clsSession
dim dDate As new Date
oSession = new mClasses.clsSession
oSession.ID = Session.Identifier
oSession.Account = Session.sUserIDSession
oSession.SessionStart = dDate
oSession.SessionEnd = nil
oSession.Notes = “”
Return oSession
End Function
[/code]
When I try to run the app, I get the following compile error:
[quote]Type mismatch error. Expected class mClasses.clsSession, but got Object.
oSession = mClasses.clsSession.CreateSessionObject[/quote]
I returned a clsSession object, so what does the error mean?
thanks