🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.basic.visual.misc
3 messages
3 total messages Started by sou|burn Sun, 07 Oct 2001 01:00
:::::::: Dynamic Array Dillema ::::::::
#336
Author: sou|burn
Date: Sun, 07 Oct 2001 01:00
27 lines
2014 bytes
Hi there

I'm having trouble with the following code

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Public EXP()
EXP_Max as integer
v2 is a integer (always stays smaller than EXP_Max)
sTag is a string
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Select Case Left$(sTag, 3)
    Case "ENG"
        ReDim Preserve EXP(EXP_Max, 4) As String
        EXP_Max = EXP_Max + 1
        EX(v2, 0) = sTag
End Select
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::

I get an "subscript out of range" error on the ReDim line as soon as EXP_Max
= 2, meaning there are values in the array that needs 2 b "preserved"

any help would be very much appreciated

sou|burn
Re: :::::::: Dynamic Array Dillema ::::::::
#337
Author: Lee Weiner
Date: Sun, 07 Oct 2001 01:15
38 lines
2278 bytes
It appears you are trying to ReDim the first dimension of the array.  If you 
check HELP for the ReDim statement, you will find only the last dimension can 
be ReDimmed.

Lee Weiner
lee DOT weiner AT home DOT com

In article <9po9gh$qjs$1@ctb-nnrp1.saix.net>, "sou|burn" <ralfvb@msn.com> 
wrote:
>Hi there
>
>I'm having trouble with the following code
>
>::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>::::::::::::::::::::::::::::::::::::::::::::::::::
>Public EXP()
>EXP_Max as integer
>v2 is a integer (always stays smaller than EXP_Max)
>sTag is a string
>::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>::::::::::::::::::::::::::::::::::::::::::::::::::
>Select Case Left$(sTag, 3)
>    Case "ENG"
>        ReDim Preserve EXP(EXP_Max, 4) As String
>        EXP_Max = EXP_Max + 1
>        EX(v2, 0) = sTag
>End Select
>::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>::::::::::::::::::::::::::::::::::::::::::::::::::
>
>I get an "subscript out of range" error on the ReDim line as soon as EXP_Max
>= 2, meaning there are values in the array that needs 2 b "preserved"
>
>any help would be very much appreciated
>
>sou|burn
>
>
Re: :::::::: Dynamic Array Dillema ::::::::
#338
Author: Mike Williams
Date: Sun, 07 Oct 2001 04:00
43 lines
2385 bytes
You can only change the size of the last dimension of the array. Just swap
them about and you will then be able to do:

ReDim Preserve EXP(4, EXP_Max) As String

Mike


"sou|burn" <ralfvb@msn.com> wrote in message
news:9po9gh$qjs$1@ctb-nnrp1.saix.net...
> Hi there
>
> I'm having trouble with the following code
>
>
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> ::::::::::::::::::::::::::::::::::::::::::::::::::
> Public EXP()
> EXP_Max as integer
> v2 is a integer (always stays smaller than EXP_Max)
> sTag is a string
>
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> ::::::::::::::::::::::::::::::::::::::::::::::::::
> Select Case Left$(sTag, 3)
>     Case "ENG"
>         ReDim Preserve EXP(EXP_Max, 4) As String
>         EXP_Max = EXP_Max + 1
>         EX(v2, 0) = sTag
> End Select
>
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> ::::::::::::::::::::::::::::::::::::::::::::::::::
>
> I get an "subscript out of range" error on the ReDim line as soon as
EXP_Max
> = 2, meaning there are values in the array that needs 2 b "preserved"
>
> any help would be very much appreciated
>
> sou|burn
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads