[Gambas-user] Problem with array, zero object

Jussi Lahtinen jussi.lahtinen at gmail.com
Thu Feb 25 23:38:32 CET 2021


Using public variable shouldn't be an issue. I bet you use the variable
somewhere else, which makes it null, before the clearing.
Why are you clearing empty array anyway? Or is that just effect of
cutting/editing the code for us?
If you want that to be solved, we need to see more code.


Jussi


On Thu, Feb 25, 2021 at 9:54 PM Dag Jarle Nerland Johansen - Gambas <
gambas at cd-bahia.com> wrote:

> No, of course I checked that :-)
> Always use a GV_iNIT procedure at program-start - routine.
> Any way, solved it with a local declaration, no idea why the Public
> declaration doesn't work in this single case, and will not trace that
> either.
> Thank you
>
> Am 25.02.21 um 20:41 schrieb Bruce Steers:
>
> i have no problems with that code, it works just fine here.
>
> is it being run before the gridview is populated?
> i could not guess, sorry
> BruceS
>
>
>
> On Thu, 25 Feb 2021 at 18:51, Dag Jarle Nerland Johansen - Gambas <
> gambas at cd-bahia.com> wrote:
>
>> Hi,
>> suddenly I have a problem with an array, get "zero object"
>> I want to save the layout of a Gridview.
>> Here a part  of the source:
>>
>>
>> *Public PRO_G_LO As New Integer[] *
>> *PRO_G_LO.Clear*
>> *For y = 0 To PRO_G.Rows.Count - 1*
>> *  PRO_G_LO.Add(y)*
>> *  PRO_G_LO[y] = PRO_G.Rows[y].Width*
>> *Next  *
>>
>> Why do I get "zero object" when it comes to the line *PRO_G_LO.Clear*  ?
>> I have used several other arrays in the program, they all works fine with
>> the .Clear statement, also the first time they are accessed. Seems I must
>> be blind...
>>
>> Grateful for any help!
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210226/05e5e1d1/attachment.htm>


More information about the User mailing list