turbot_yu
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.
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.
ASKER
I first tried: updata As dataUpload
but not work so changed to: updata As Object
but not work so changed to: updata As Object
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
changed sub to function, then ok.
something else in the code, or this line?
Public Function EventDate
thanks for the grade
Public Function EventDate
thanks for the grade
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