[Gambas-user] Problem with String[]

gian bagoneo at libero.it
Fri Nov 18 18:05:11 CET 2022


Il 18/11/22 17:51, T Lee Davidson ha scritto:
> On 11/17/22 13:25, Dag JNJ wrote:
>> Hi all,
>> I have defined this:
>>
>> P/ublic arorder As New String[]//
>> //Public arorderb As New String[]//
>> /
>> and make this in a subroutine:
>>
>> /    arorder.Add(fld)//
>> //    arorderb.Add(ada)
>>
>> ///
>> /fld/ contains a field name, /ada/ = "ASC"
>>
>> the first assignment with /aroder/ succeeds, the second with 
>> /arorderb/ makes an error : null object
>> I can't see any difference between these objects, and they are only 
>> changed in  this routine (so far).
>> I am thankful for any help, allt he best, Dag JNJ
> 
> It is quite difficult to determine what may be causing that without 
> seeing the full code. Perhaps somewhere 'arorderb' is getting nullified. 
> Can you pare it down to a small project, that reproduces the issue, that 
> you can share?
> 
> 

Hi Dag,

this code here works fine:
'-----------------
Public arorder As New String[]
Public arorderb As New String[]

Public Sub Main()

   Dim fld As String = "Asc"
   Dim ada As String = "FOO"

   arorder.Add(fld)
   arorderb.Add(ada)
   Print arorder[0];; arorderb[0]

End
'------------------
Regards

Gianluigi


More information about the User mailing list