Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding Items to ComboBox
Message
De
29/08/2001 04:19:23
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00549962
Message ID:
00550170
Vues:
20
>How do you add 2 items to each row (one being a group, the other a group id) without displaying the 2nd item? I know how to do it using a SQL statement as the rowsourcetype, but I can't get it working in the INIT() event. I have:
>
>THIS.ADDITEM("",1,1)
>x = 2
>SCAN
> THIS.ADDITEM(t_groups.group_name,x,1)
> THIS.ADDITEM(t_groups.group_code,x,2)
> x = x + 1
>ENDSCAN

Michael,
In that case you use AddListItem() - replace additem with addlistitem.
In AddItem() second parameter is item index, where in AddLIstItem it's Item id.
However especially with long tables this would be time consuming and unnecessary. Use SQL rowsourcetype instead.
*init
with this
 .RowSourceType = 3
 .RowSource = 'select group_name, group_code '+;
     'from myTable '+;
     'where myCriteria '+;
     'order by 1'+;
     'into cursor crsCombo'
 .Columncount = 2
 .BoundColumn = 2
 .ColumnWidths ='100,0'
 .Style = 2
endwith
Your criteria values might change on the fly. In that case you do a combo.requery. At any time instead of saying :
thisform.myCombo.Value or thisform.myCombo.List(thisform.myCombo.ListIndex,2) you could simply say :
crsCombo.Group_code or crsCombo.Group_Name to query any column in selected row.
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