Re: Indirection
Jean-Luc Arnaud <jean-luc-E/[email protected]> Thu, 17 Jan 2019 10:01:29 +0100
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Organization | Centre Direct du Multimédia |
| Message-ID | <[email protected]> |
--------------C753C2E74442FF21A0F0A689 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Thanks a lot for your help, Jim. I'm not used to working with dictionary, but will look at this solution. Thanks for code sample, it will be be of great help!! Jean-Luc Arnaud Le 16/01/2019 à 17:03, Jim McKay a écrit : > > Have you thought about storing the arrays in a dictionary? Since the > keys/values are variants, you can assign/get an array value. > > dim myArray1(1) as string dim d as new dictionary dim Name1 as > string="myArray1" > > d.value(name1)= myArray1() > > dim resultarray() as string resultarray=d.value(name1) > result=resultarray(0) > > You also might look at introspection to find the array property by name. > > Or if you need to select the array based on an index, use an array of > variants or even a 2-dimensional array if they're all the same size. > > -Jim > > On Jan 16, 2019, at 3:48 AM, Jean-Luc Arnaud > <jean-luc-E/[email protected]> wrote: > > Hi, > > On the 7th of December, I sent the below message, and got no reply. > > After seeking in Language Reference, forum and Internet, I think > Delegate could be a solution. What's your opinion? > > TIA for any help. Jean-Luc Arnaud > > ------------------------- > > Hi all, Is there a way to use a kind of indirection, just like > Dynamic strings and #, but for other type of variable, in > particular with arrays? Let say I have 3 arrays named MyArray1, > MyArray2 and MyArray3. I need to use them with indirection, > something like: > > Dim Name1 As String="MyArray1" > Dim Name2 As String="MyArray2" > Dim Name3 As String="MyArray3" > If Value=1 > Result=#Name1(0) > End If > > TIA for any help > > Jean-Luc Arnaud > --------------C753C2E74442FF21A0F0A689 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> </head> <body text="#000000" bgcolor="#FFFFFF"> Thanks a lot for your help, Jim.<br> I'm not used to working with dictionary, but will look at this solution.<br> Thanks for code sample, it will be be of great help!!<br> <br> <pre class="moz-signature" cols="72">Jean-Luc Arnaud </pre> <div class="moz-cite-prefix">Le 16/01/2019 à 17:03, Jim McKay a écrit :<br> </div> <blockquote type="cite" cite="mid:DF38BA22-0994-4310-B588-0CB8CFCB578A-ya5pPf9okEwAvxtiuMwx3w@public.gmane.org"> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <p>Have you thought about storing the arrays in a dictionary? Since the keys/values are variants, you can assign/get an array value.</p> <p>dim myArray1(1) as string dim d as new dictionary dim Name1 as string="myArray1"</p> <p>d.value(name1)= myArray1()</p> <p>dim resultarray() as string resultarray=d.value(name1) result=resultarray(0)</p> <p>You also might look at introspection to find the array property by name.</p> <p>Or if you need to select the array based on an index, use an array of variants or even a 2-dimensional array if they're all the same size.</p> <p>-Jim</p> <blockquote> <p>On Jan 16, 2019, at 3:48 AM, Jean-Luc Arnaud <a class="moz-txt-link-rfc2396E" href="mailto:jean-luc-E/[email protected]"><jean-luc-E/[email protected]></a> wrote:</p> <p>Hi,</p> <p>On the 7th of December, I sent the below message, and got no reply.</p> <p>After seeking in Language Reference, forum and Internet, I think Delegate could be a solution. What's your opinion?</p> <p>TIA for any help. Jean-Luc Arnaud</p> <p>-------------------------</p> <p>Hi all, Is there a way to use a kind of indirection, just like Dynamic strings and #, but for other type of variable, in particular with arrays? Let say I have 3 arrays named MyArray1, MyArray2 and MyArray3. I need to use them with indirection, something like:</p> <pre>Dim Name1 As String="MyArray1" Dim Name2 As String="MyArray2" Dim Name3 As String="MyArray3" If Value=1 Result=#Name1(0) End If</pre> <p>TIA for any help</p> <p> Jean-Luc Arnaud</p> </blockquote> <img src="https://u9098352.ct.sendgrid.net/wf/open?upn=W5IIOHYh8Ix-2FlmNrgtTomW8ATk7pXvOSwl3ev5ZofJfs1Jur6X7wo1Y1jDFc6xukd5xYwY8PFGMHWki07-2Fz3cpldeWHKnX0YjQad80JSDM0TOlphFgaykMNBnil2CBS-2B8WGvEJavUlsqFGPZo-2FVY9-2BoCZXjIKJJllwN-2FtoyaXjlbLUwmkWQVrNCJjb-2FPFbdvGKAhjm2i7OXM1FZcLo-2BDh2Ax-2BFFSYVP6VR5VgnqdCXI-3D" alt="" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" moz-do-not-send="true" width="1" height="1" border="0"> </blockquote> <br> </body> </html> --------------C753C2E74442FF21A0F0A689--