Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox selections to delimited string
Message
De
18/11/1999 11:22:28
 
 
À
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:
00292494
Vues:
20
Oops...

> thisform.mytextbox.value = thisForm.List1.List(nCnt) + ","

You may have all items selected, but you saying here forget any prevous contents of the list box and just keep the last one. Try:

thisform.mytextbox.value = thisform.mytextbox.value + thisForm.List1.List(nCnt) + ","

You will also need to clear the value before the loop:

thisform.mytextbox.value = ""

...and remove the final comma at the end of the string outside the loop

thisform.mytextbox.value = left( thisform.mytextbox.value, len( thisform.mytextbox.value ) - 1 )

This should sort you out.

(By the way, I would avoid referencing and updating an objects value like this. I assume this is for example purposes only. If the result is to be within a textbox's value, the perform the processing on a local variable and set the textbox's value once at the end)

Jason


>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?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform