1 Replies - 2002 Views - Last Post: 04 December 2008 - 02:29 PM Rate Topic: -----

#1 Wolf01  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-December 08

Check array of types

Posted 04 December 2008 - 10:07 AM

Hi, I needed to use an array of types, but I have some troubles checking it to catch if it is "Nothing" or "Null"

This is what I've done so far:
in declarations:
private type MyType
  variable1 as integer
  variable2 as string
end type

private arrayOfTypes() as MyType


then in the code:
if ubound(arrayOfTypes)=0 then
  redim arrayOfTypes(1)
else
  redim arrayOfTypes(ubound(arrayOfTypes)+1)
end if


But it throws "subscript out of range" when the array is not initialised, because just erased by another function or it is the first use
Since I have no clue on how to check if the array is valid, because if I try to catch "null" and "nothing" with
if arrayOfTypes is nothing then dosomething()
'or
if arrayOfTypes(0).variable1 is null then dosomething()
'and other similar tests
it give another error like "Type mismatch" and I can't safely use the array because I can't always redim without knowing the exact length
I have some ideas which make use of the on error goto label and on error resume next, but I'm trying to avoid spaghetti code since I already have an error handling goto on all functions

so I ask your help to get rid of this problem

Is This A Good Question/Topic? 0
  • +

Replies To: Check array of types

#2 djkitt  Icon User is offline

  • D.I.C Head

Reputation: 29
  • View blog
  • Posts: 189
  • Joined: 22-May 08

Re: Check array of types

Posted 04 December 2008 - 02:29 PM

Never mind ... I thought this was in the vb.net area...

Sorry to waste your time...

Kitt

This post has been edited by djkitt: 04 December 2008 - 02:32 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1