Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Array settings, listbox
Message
De
25/04/2001 02:34:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
24/04/2001 23:11:15
Jimi Lee
Pop Electronic Products Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00499410
Message ID:
00499433
Vues:
15
>hi all,
>
>I want to create a 2-dimensional array A[n,3] where I want n to be dynamically change in run-time, is it possible? How should I declare and use it?
>
>I need this because I want to maintenance a listbox with 3 columns and unlimited rows, where users can add or remove any rows from it. I planned to do the data change in the array and requery the listbox for displaying. Do you think I'm doing it in the right way? I'm kinda new in VFP so any comment is welcomed! :)
>
>Thanks for any help in advance!
>
>-Jimi

Jimi,
You add a new property to form like this (new property name):
aMyArray[1]
Initial size is not important if you do't know beforehand. Then use it :

dimension thisform.aMyArray[ix,jx]
or :
select ... into array thisform.aMyArray
or :
aAnotherLocalArray[ix,jx] = '...'
acopy(aAnotherLocalArray, thisform.aMyArray)
etc.
However 'unlimited' rows is not an option because an array could hold 65000 elements at max (not possible with a cursor either).
You might be doing it right. Depends on what you want to do.What you're trying to do might not need arrays. ie :
with thisform.myListBox
  .Addlistitem('Item35 Column1', 35, 1)
  .Addlistitem('Item35 Column2', 35, 2)
  .Addlistitem('Item35 Column3', 35, 3)
endwith
would add Item35 in a 3 column listbox. 35 there is the unique list itemid and not need to be same as indexid (could be any other value - ie: pk of a table row). To remove an item from listbox you would use :
thisform.myListBox.RemoveItem(IndexId)

You can manage array approach more easily.
Saying it's the right way is hard :) In VFP a task could be accomplished in many ways. ie: if those addings and removing from listbox would then go to a table you might directly use a fields, alias or sql rowsource as well.
And in the future you might decide completing a particular task fits into a grid than a listbox as well :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform