Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Saving listbox items back to table
Message
De
01/04/1998 09:16:50
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/04/1998 09:09:24
Mandy Mccord
Public Interest Breakthroughs, Inc.
Albany, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00088653
Message ID:
00088660
Vues:
25
>Hi all!
>
>First off, I'm trying to get motivated to work inside when we're having a record heatwave here in the Northeast and I've got major spring fever! ;^)
>
>But back to the grind.. I'm trying to use the Foxpro (v5.0) sample "moverlist" container to use two list boxes on a form for my users to select multiple items from a master list.
>
>There are two list boxes, the left one is "LstSource" which contains a master list of items for my users to select. The second box on the right is the "LstSelected" which contains my users' selections from the LstSource.
>
>I created a local view, "lvesin" which is the source of data for "LstSource". I use the following code in the container's Init method to populate the left list box:
>
> SELECT lvesin
> SCAN
> This.LstSource.AddItem(lvesin.dispval)
> ENDSCAN
>
>Based on the sample code, I use the following code in my "LstSource" double click method to transfer items from the left source list to the right selected list:
>
> THIS.Parent.lstSelected.AddItem(THIS.List(THIS.ListIndex))
> This.RemoveItem(THIS.ListIndex)
> THIS.Parent.Refresh
>
>All of this is working fine, but I'm not sure how to save the final selections in the right list box back to my table "extsvcs". I want to save lvesin.codeno (which corresponds to lvesin.dispval shown in the list boxes) to "extsvcs". I'm thinking I'd like each selection to be a record in "extsvcs". Eg. if the user selects "apples, oranges, bananas", I want three records added to "extsvcs" which would look like:
>
>Record 1: userid ... 'code for apples'
>Record 2: userid ... 'code for oranges'
>Record 3: userid ... 'code for bananas'
>
>Does this make sense? What's the best way to do this?
>
>One final question. Initially my list boxes display the items alphabetically which is what I want. But if I move an item from left to right then back to the left box, the item is displayed at the bottom of the list, not back where it belongs alphabetically. Any clues where I 'refresh' the list to make it alphabetically again?
>
>Thanks as always!
>
>Mandy
In a command button add this code :
for ix = 1 to thisform.lstSelected.listcount
   insert into extsvcs (myFruit) values ;
     (thisform.lstSelected.list(ix))
endfor
For second thisform.LstSource.sorted = .t., thisform.LstSource.refresh.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform