Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you add to a COMBO BOX?
Message
 
To
30/10/1997 12:12:03
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00057406
Message ID:
00057433
Views:
40
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform