Public Type vs. Public variable() as Double
You are creating an array of mydims, not an array of elements in mydims. You
have to reference it the same way its declared ...
If mydims(z).typeheight > maxheight then ...
--
Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
Quote:
> I am trying to change from using several different arrays
> holding pieces of information
> e.g. (in Module1)
> Public name() as String
> Public height() as Integer
> Public width() as Double
> Public depth() as Long
> to a Data Type containing those members
> e.g. (also in Module1)
> Public Type UnitDims
> typename as String
> typeheight as Integer
> typewidth as Double
> typedepth as Long
> End Type
> Public mydims() as UnitDims
> (NOTE: Integer, double and long types are used only for
> example purposes)
> However, when I change what was working code in FormMain:
> On Error Resume Next
> x = Ubound(height) 'Has Array be initialized?
> errchk = IIf(Err=0,True,False)
> If errchk Then
> For z = 0 to Ubound(height)
> If height(z) > maxheight then
> .....
> End If
> Next x
> End If
> and try to change it to:
> On Error Resume Next
> x = Ubound(mydims) 'Has Array be initialized?
> errchk = IIf(Err=0,True,False)
> If errchk Then
> For z = 0 to Ubound(mydims)
> If mydims.typeheight(z) > maxheight then
> .....
> End If
> Next x
> End If
> I get "Compile error - invalid qualifier" and the mydims
> (at the "If mydims.typeheight (z)..." line)is highlighted.
> I've tried using Module1.mydims.typeheight(z), but I
> receive the same error?
> Any suggestions?
> Thanks,
> Craig
> I have tried