Re: Defining the dimensions of an array by Fred
Fred
Wed Sep 21 10:33:06 CDT 2005
Are you tring to define two variables, (row and an array named N with 3
elements)? You can't specify a variable type in VFP like that if what
you're trying to do is get a numeric type variable that's 3 wide, that only
applies to fields in a table.
If it's supposed to be 2 variables, you need a comma separating them:
PUBLIC row, n(3)
You really shouldn't make such extensive use of PUBLIC type variable in
Visual FoxPro, it's a very bad habit that can lead to debugging problems.
Use properties of _SCREEN if absolutely necessary to have a global scope or
just properties of the form that requires these values.
--
Fred
Microsoft Visual FoxPro MVP
"Lie" <Lie@discussions.microsoft.com> wrote in message
news:A647D961-32C8-48B2-BF97-DBFBF6903278@microsoft.com...
> Thanks, have changed it and no error in compilation.
>
> another problem is variable declaration:
> in vfp 5.0, declaration below has no problem:
> PUBLIC row N(3)
>
> but in vfp 7.0, always prompt syntax error.
> is it possible not to change it? any other setting/tool to do conversion
> and
> compilation successfully?
>
> Thanks
>
> "Fred Taylor" wrote:
>
>> You don't need dimension at all if you do PUBLIC myarray[10].
>>
>> DIMENSION is just a keyword that allows you to redimension an existing
>> array
>> or create a new one in the default scope, which is usually PRIVATE.
>>
>> --
>> Fred
>> Microsoft Visual FoxPro MVP
>>
>>
>> "Lie" <Lie@discussions.microsoft.com> wrote in message
>> news:C937F1C0-47DD-4064-BCB1-ED00B6F2C25A@microsoft.com...
>> > if we declare array with DIMENSION command, is it a public variable? so
>> > we
>> > need not to declare 'PUBLIC DIMENSION myarr[10]' , enough with
>> > 'DIMENSION
>> > myarr[10]'?
>> > i am totally new in vfp. trying to convert vfp 3.0 to vfp 5.0, and
>> > after
>> > making few lines code changes, it's successfully converted to vfp 5.0.
>> > now trying to convert vfp 5.0 to vfp 7.0/9.0, but have error in
>> > declaring
>> > public dimension variables, prompt it's unknown variable.
>> >
>> > Thanks
>> >
>> >
>> >
>> >
>> > "Rush Strong" wrote:
>> >
>> >> You needn't declare it a second time; I think DIMENSION is the command
>> >> that
>> >> he's looking for.
>> >>
>> >> - Rush
>> >>
>> >> "Eric den Doop" <ericdendoop@xspamblockxfoxite.com> wrote in message
>> >> news:uaZbJv2WEHA.2840@TK2MSFTNGP11.phx.gbl...
>> >> > Hello, sm!
>> >> > You wrote on Sat, 26 Jun 2004 00:30:01 -0700:
>> >> >
>> >> > s> Is it possible in vfp to declare an public array (so that the
>> >> > array
>> >> > is
>> >> > s> visible anywhere in the application) and then define its
>> >> > dimensions
>> >> > at
>> >> a
>> >> > s> later stage (when I know what the size of the array is going to
>> >> > be)?
>> >> >
>> >> > s> Something like redim in visual basic...
>> >> >
>> >> > Yes, simply issue the PUBLIC ARRAY again.
>> >> >
>> >> > Try this:
>> >> > <vfp_code>
>> >> > * declare first time
>> >> > PUBLIC ARRAY myArray[1]
>> >> > myArray[1] = "Hello"
>> >> > ?ALEN(myArray) && 1
>> >> > * declare second time
>> >> > PUBLIC ARRAY myArray[2]
>> >> > myArray[2] = "World"
>> >> > ?ALEN(myArray) && 2
>> >> > ?myArray[1] + " " + myArray[2]
>> >> > </vfp_code>
>> >> > --
>> >> > Eric den Doop
>> >> > www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By
>> >> > VFP8
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>