[Gambas-user] Struct with Array Field

vuott at tutanota.com vuott at tutanota.com
Wed Apr 5 14:54:52 CEST 2023


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 ]----
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230405/f560e79a/attachment.htm>


More information about the User mailing list