[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

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.
0
turbot_yu
Asked:
turbot_yu
  • 3
  • 2
1 Solution
 
bruintjeCommented:
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
0
 
turbot_yuAuthor Commented:
I first tried: updata As dataUpload
but not work so changed to: updata As Object
0
 
bruintjeCommented:
it seems to be falling over these 2

ByRef EventStart As Date, ByRef EventEnd As Date

could it be that  EventStart or EventEnd are containing something else then a date?
0
 
turbot_yuAuthor Commented:
changed sub to function, then ok.
0
 
bruintjeCommented:
something else in the code, or this line?
Public Function EventDate

thanks for the grade
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now