[Gambas-user] Struct with Array Field

Mayost Sharon sharon at 455.co.il
Wed Apr 5 16:57:57 CEST 2023


first thanks

Is it supposed to be like this?
For each field that is an array I will have to say NEW separately

The fields are inside a Struct
I thought that if I do NEW to Struct
This will do it on all fields

Thanks


---------- Original Message -----------
From: vuott--- via User <user at lists.gambas-basic.org>
To: Gambas Mailing List <user at lists.gambas-basic.org>
Cc: vuott at tutanota.com
Sent: Wed, 5 Apr 2023 14:54:52 +0200 (CEST)
Subject: Re: [Gambas-user] Struct with Array Field

> Solution:
> 
> Public Struct ami_response
>   string As String
>   event_list As String[]
> End Struct
> 
> Private v_response_temp As New Ami_response
> 
> Public Sub Main()
> 
>   v_response_temp.event_list = New String[]
> 
>   v_response_temp.event_list.Add("Test")
>   
>   Print v_response_temp.event_list[0]
> 
> End
> 
> -----
> 5 apr 2023, 13:26 da sharon at 455.co.il:
> 
> > Hello
> >
> > How to add a Field that is an array inside a Struct
> >
> > i tried
> >
> > public struct ami_response
> >  string As String
> >  event_list As String[]
> > End Struct
> >
> > Private v_response_temp As New Ami_response
> >
> > But when:
> > v_response_temp.event_list.Add("Test")
> > Returns error: Null Object
> >
> > Thank you
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> >
------- End of Original Message -------



More information about the User mailing list