Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo Box Problems
Message
De
05/08/1998 13:53:00
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00124164
Message ID:
00124173
Vues:
18
>I'm trying to load an array into a combo box after the form has been loaded. I'm relating the contents of the CB to another field in a table, which I choose from another CB. I'd appreciate some help on this. Here's the code i'm using:
>
>LOCAL lnACnt && set local variable for array counter.
>
>lnACnt = 1 && initialize variable
>
>gcDeptNo = THISFORM.cboDept.VALUE
>
>IF !EMPTY(THISFORM.cboDept.VALUE)
>*--Redefine group array pertaining to the department chosen
> SELECT DISTINCT snag_temp.ass_group ;
> FROM snag_temp ;
> WHERE snag_temp.ass_l_dept = gcDeptNo ;
> INTO ARRAY gacGroupArray
> THISFORM.cboGroup.ENABLED = .T. &&Enable combo box
> THISFORM.cboGroup.CLEAR &&Clear combo box
>*--Load array into combo box
> FOR lnACnt = 1 TO ALEN(gacGroupArray)
> THISFORM.cboGroup.ADDITEM
> lnACnt = lnACnt + 1
> ENDFOR
>ELSE
> THISFORM.cboGroup.ENABLED = .F.
>ENDIF
>
>THISFORM.REFRESH()
>
>I believe I'm thinking in VB, but isn't the additem method similar.
>
>Thanx in advance.
>Perry
	FOR lnACnt = 1 TO ALEN(gacGroupArray)
		THISFORM.cboGroup.ADDITEM(gacGroupArray[lnACnt])
	ENDFOR
If you use more than one column then try addlistitem instead. Also directly setting rowsource to SQL and requerying might be more effective.
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