Link to home
Start Free TrialLog in
Avatar of turbot_yu
turbot_yuFlag for Singapore

asked on

How to pass a type into a function

I defined a type in global.bas
Public Type dataUpload 'data structure to hold upload data
     timestamp As Date
     Samplerate As Single  'point per cycle20ms
     Waveform As Variant
     Instid As String
     Eventchannel As Integer
     'curr_channel
     Eventtype As Integer
     
     WaveformV1() As Single
     WaveformV2() As Single
     WaveformV3() As Single
     WaveformI1() As Single
     WaveformI2() As Single
     WaveformI3() As Single
     WaveformI4() As Single
     
     ESstartTime As Date
     ESendTime As Date

End Type

In form I try to define and pass into a function:

Dim updata As dataUpload

EventLength = EventDate(updata, pqdifLogicalObj, index, numObsv, EventStart, EventEnd)

The function defined as:
Public Function EventDate(updata As Object, pqdifLogicalObj As IPQDIFLogical, index As Integer, numObsv As Integer, ByRef EventStart As Date, ByRef EventEnd As Date) As Integer

error msg: ByRef agument type mismatch.
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Hello turbot_yu,

not sure if that is the error but you pass on > Public Function EventDate(updata As Object ....
while its a type like > Public Function EventDate(updata As dataUpload

hope this helps a bit
bruintje
Avatar of turbot_yu

ASKER

I first tried: updata As dataUpload
but not work so changed to: updata As Object
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
changed sub to function, then ok.
something else in the code, or this line?
Public Function EventDate

thanks for the grade