Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21285

Passing a nested UDT array to a sub throws compile error...

$
0
0
Hello everyone,

I'm building a programming tool for an arduino project, but I seem to get stuck now.

background info: when activating a wireless transmitter (Zender in Dutch), the arduino should process 16 programmable commands, described in Zenders(x).Aan(1 to 16). 1 command consists of 3 bytes: The Command itself, the Unit it has to control, and a Value.

The Sub buildZenderAan has to fill a listbox (ZenderAan ~Transmitter activated) with readable lines of text, based on these 16x3 bytes.
And the Sub works if I directly refer to Zenders(x).Aan(1 to 16) (In the sub itself) and the only argument I pass to the sub is x (The number of the transmitter we're programming).

Problem is, that there also is a ZenderUit (~Transmitter DEactivated), and in the near future There will be a clock-function, and wired inputs.
So I thought i'd streamline the sub a bit to accept (and change, if necessary), only the bit that holds the commands.


Code:

Public Type Commando
  Text As String
  Command As Byte
  Unit As Byte
  Value As Byte
End Type

Public Type Zender
  Naam As String * 16
  Adres As String * 8
  Aan(16) As Commando
  Uit(16) As Commando
End Type

Public Zenders(96) As Zender

Code:

Public Sub buildZenderAan(ByRef intarray() As Commando)
  blahblahblah
End Sub

When trying to start the application, it immediately throws an error: 'compile error: Type mismatch: array or user-defined type expected'

Code:

buildZenderAan (Zenders(1).Aan)
Well, maybe it's me, but I definitely think I'm passing an array. Or aren't I? Help?:o

Viewing all articles
Browse latest Browse all 21285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>