Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you add to a COMBO BOX?
Message
 
À
30/10/1997 12:12:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00057406
Message ID:
00057433
Vues:
46
>>Robert,
>>
>>Are you trying to allow the user to enter a value in the textbox area of the combobox and if what they typed doesn't already exist in the combobox add it to the combobox choices?
>
>Colin,
>yes - I want to treat the combo like a field.

Robert,

I've done something similar. The combobox is a list of positions and allows the user to add new values. The code below is in the combobox's .Valid method. The combobox's RowSource is Position.Position and the ControlSource is People.Position.

IF NOT SEEK(ALLTRIM(THIS.DisplayValue),"POSITION")
mnadd=MESSAGEBOX("Do you wish to add this position type?",4+32+256,;
ALLTRIM(THIS.DisplayValue)+" not found")
IF mnadd=6
INSERT INTO Position (Position) ;
VALUES (THIS.DisplayValue)
REPLACE People.Position WITH THIS.DisplayValue
THISFORM.rtgPageFrame1.Page1.cmbPosition.Requery
THISFORM.rtgPageFrame1.Page1.Refresh
ELSE
THISFORM.rtgPageFrame1.Page1.cmbPosition.DisplayValue=""
THISFORM.rtgPageFrame1.Page1.cmbPosition.Value=""
THISFORM.rtgPageFrame1.Page1.cmbPosition.SetFocus
ENDIF
ENDIF
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada

cmagee@metroland.com

Never mistake having a career with having a life.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform