<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body><div style="font-family:Helvetica,Arial;font-size:13px; ; ">Hello,</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">I thing the simple way to manage an Array for various kind of fiels could be an Array of Class</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">Example:</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="; margin: 0px;"><span style="font-family: Helvetica, Arial; font-size: 13px;">- Create a Class named ‘</span><font face="Courier New"><span style="font-style: normal;">ClassUserRecord</span></font>’ containing:</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Public FirstName as String</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Public LastName as String</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Public Address1 as String</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Public Address2 as String</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Public PhoneNumber as String</span></font></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">- In your Form or module, instantiate an Array based in this Class</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Public ArrayOfUser as New ClassUserRecord[]<br></span></font></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">- To add a new entry in the Array</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;">Public Sub Add_New_User(FirsName as String, LastName as String, Address1 as String, Address2 as String, PhoneNumber as String)</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Dim NewUserRecord as ClassUserRecord</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>NewUserRecord = New ClassUserRecord</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NewUserRecord.FirstName = </span></font><span style="font-family: "Courier New";">FirsName</span></div><div style="; margin: 0px;"><div style="margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NewUserRecord.LastName = </span></font><span style="font-family: "Courier New";">LastName</span></div><div><div style="margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NewUserRecord.Address1 = </span></font><span style="font-family: "Courier New";">Address1</span></div></div><div><div style="margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NewUserRecord.Address2 = </span></font><span style="font-family: "Courier New";">Address2</span></div></div><div><div style="margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NewUserRecord.PhoneNumber = </span></font><span style="font-family: "Courier New";">PhoneNumber</span></div></div><div><span class="Apple-tab-span" style="white-space: pre; font-style: normal;"><font face="Courier New"> </font></span></div></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>ArrayOfUser.Add(NewUserRecord)</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;">End</span></font></div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; ; ">- To list all User in the Array</div><div style="font-family:Helvetica,Arial;font-size:13px; ; "><br></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;">Public Sub List_User_Array()</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Dim ItemUser as ClassUserRecord</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"> if ArrayOfUser <> NULL Then</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>print “Sorry, no User in the Array for now”</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>End If</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>For Each ItemUser In ArrayOfUser</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Print “FirstName: “ & ItemUser.FirstName</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Print “LastName: “ & ItemUser. LastName</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Print “Address1: “ & ItemUser. Address1</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Print “Address2: “ & ItemUser. Address2</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Print “PhoneNumber: “ & ItemUser. PhoneNumber</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Next</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><span class="Apple-tab-span" style="white-space:pre"> </span>Print “Number of records: “ & ArrayOfUser.Count</span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;"><br></span></font></div><div style="; margin: 0px;"><font face="Courier New"><span style="font-style: normal;">End</span></font></div><div style="font-size: 13px; ; margin: 0px;"><br></div><div style="font-size: 13px; ; margin: 0px;">Etc…...</div><div style="font-size: 13px; ; margin: 0px;"><br></div> <div class="gmail_signature"><div style="font-family:helvetica,arial;font-size:13px">This is just examples….</div><div style="font-family:helvetica,arial;font-size:13px"><br></div><div style="font-family:helvetica,arial;font-size:13px">— </div><div style="font-family:helvetica,arial;font-size:13px">Olivier Cruilles</div><div style="font-family:helvetica,arial;font-size:13px"><br></div></div> <br><p class="airmail_on">On May 5, 2020 at 10:22:05, T Lee Davidson (<a href="mailto:t.lee.davidson@gmail.com">t.lee.davidson@gmail.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>On 5/5/20 8:39 AM, Dag Jarle Nerland Johansen - Gambas wrote:
<br>> Hi,
<br>> I got unsure how to create a dynamic two-dimensional array.
<br>> I need to read in a CSV for processing addresses.
<br>> That means a variable length of the array, but the field numbers are always the same.
<br>> forename, surename, mail ...
<br>> Can anyone help,
<br>> thanks,
<br>> (I know I should know this by now but I only program now and then with long pauses in between)
<br>> Dag
<br>
<br>Perhaps an array of Collection (Collection[]) would be better suited.
<br>
<br>
<br>--
<br>Lee
<br>
<br>----[ http://gambaswiki.org/wiki/doc/netiquette ]----
<br></div></div></span></blockquote></body></html>