Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox code
Message
 
À
24/10/2008 16:22:48
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01357042
Message ID:
01357056
Vues:
15
>>>>>I'm trying to get a ListBox to sort on the 2nd column (TypeDesc), but it just always sorts on the 1st column (TypeCode). What do I need to do?
>>>>>
>>>>>	WITH .Container1.lstAvailable
>>>>>		SELECT AvailableServiceTypes
>>>>>		SCAN FOR ! DELETED()
>>>>>			.AddItem( TypeCode )
>>>>>			.List[ .NewIndex, 2 ] = TypeDesc
>>>>>		ENDSCAN
>>>>>		.Sorted = .T.
>>>>>	ENDWITH
>>>>>
>>>>
>>>>List and Combos ALWAYS sort by first column.
>>>>So instead of Sorted = .t. use Sorted = .f. but fill Items from Sorted table/cursor.
>>>>BTW why not use other RowSourceType like SQL Select?
>>>>The this code will be:
>>>>
>>>>WITH .Container1.lstAvailable
>>>>     .RowSourceType = 3
>>>>     .RowSource = [SELECT TypeCode, TypeDesc FROM AvailableServiceTypes ORDER BY TypeDesc INTO CURSOR lstAvailableCrs]
>>>>     .Requery()
>>>>ENDWITH
>>>>
>>>>And if your SET DELETED is ON you will see no deleted records :-)
>>>
>>>It's a MoverBox control and I need to be able to move items back and forth. How can I maintain order on the TypeDesc as I move items between the lists?
>>
>>
>>
>>O!
>>Then:
>>
>>SELECT TypeCode, TypeDesc FROM AvailableServiceTypes ORDER BY TypeDesc INTO CURSOR lstAvailableCrs
>>WITH .Container1.lstAvailable
>>      SELECT lstAvailableCrs
>>      SCAN
>>         .AddItem( TypeCode )
>>         .List[ .NewIndex, 2 ] = TypeDesc
>>      ENDSCAN
>>ENDWITH
>>
>
>I have to rerun the SQL each time an item is moved?! Hmmm... I don't like that. Stupid that I can't sort the listbox on the 2nd column. I think I'll drop the TypeCode and just have a single column listbox.



Move it to second column if you need it.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform