Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox selections to delimited string
Message
De
13/11/1999 05:13:40
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
12/11/1999 13:28:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00290666
Message ID:
00290884
Vues:
16
>If this message looks familiar its because I posted it earlier but it disappeared. I want to make a delimited string from the selected items in a multiselect listbox. So far all the code I can muster is:
>
>FOR nCnt = 1 TO ThisForm.List1.ListCount
> IF ThisForm.List1.Selected(nCnt)= .t.
> thisform.mytextbox.value = thisForm.List1.List(nCnt) + ","
> ENDIF
>ENDFOR
>
>(I'm displaying the string in mytextbox to check progress during development)
>
>This returns one selection plus a comma. But how do I get all selections?


You were very close :)
local lcValue
with ThisForm.List1
  lcValue = ""
  FOR nCnt = 1 TO .ListCount
    IF .Selected(nCnt)
       lcValue = lcValue + ;
          iif(empty(lcValue),"",",") + ;
          .List(nCnt)
    ENDIF
  ENDFOR
endwith
thisform.mytextbox.value = lcValue
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