Arrays and classes in vbscript

Results 1 to 2 of 2

Thread: Arrays and classes in vbscript

  1. #1
    Join Date
    Dec 1969

    Default Arrays and classes in vbscript

    I have a class defined as follows:<BR><BR>class tripLeg<BR> public date<BR> public startTime<BR> public duration<BR> public origin<BR> public destination<BR> public timetype<BR>End class<BR><BR>I have an array of tripLegs called trip and so far all is good except for when I run the following:<BR><BR>response.write ubound(trip)<BR>response.write trip(1).timeType<BR> <BR>For i = 1 To UBound(trip)<BR> Select Case trip(i).timeType<BR> ...<BR>next<BR><BR>It all works fine until the select line is reached, giving the following error:<BR><BR>Error Type:<BR>Microsoft VBScript runtime (0x800A01A8)<BR>Object required: &#039;trip(...)&#039;<BR>/transportaccred/fatigue/guidelines.asp, line 90<BR><BR>Any ideas on why this happens?<BR><BR>Thanks<BR><BR>Kent Jones

  2. #2
    Join Date
    Dec 1969

    Default Worked fine for me...

    I would *guess* that one of the members of your array is *NOT* an instance of your class!<BR><BR>To find out, try this:<BR><BR>&#060;%<BR>For i = 1 To UBound(trip) &#039; how come you start at 1 instead of 0?<BR> Response.Write i & ": " & TypeName(trip(i)) & "&#060;br/&#062;"<BR> Select Case trip(i).timeType<BR> ...<BR>Next<BR>%&#062;<BR><BR>I&#039;m betting that you will see that the value of i that blows up does *not* show "tripLeg" as the TypeName there.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts