Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Blum
  Where is Ken Blum?
 Chicago
 Illinois - United States
 Ken Blum
 Tags
Subject: Combo.AddItem(THIS.Text) does not work
Thread ID: 22965 Message ID: 22965 # Views: 18 # Ratings: 0
Version: Visual FoxPro 7 Category: General VFP Topics
Date: Wednesday, April 30, 2003 8:18:58 PM         
   


OK, I've been confused about this for xx years and I guess it's time to figure it out.

I have a ComboBox on a form, and am attempting to useit as a Drop Down Combo. RowSource is an Array generated at the ComboBox.Init...

SELECT Text_Name FROM ERGuide_CR GROUP BY 1 INTO ARRAY THISFORM.Text_Names
THIS.RowSourceType = 5
THIS.RowSource = "THISFORM.Text_Names"
THIS.ControlSource = "ERGuide.Text_Name"


The drop down works just fine. My problem is when a user types in a string that is not in the drop down it just goes blank. In the ComboBox.Valid method I do this...

IF Is_Blank(THIS.Text)
	RETURN .F.
ENDIF

IF !(THIS.Text == ERGUIDE.Text_Name)
	IF AT('_',THIS.Text) = 0
		MSB("Addition of a new Text Name requires an underscore (_)")
		RETURN .F.
	ENDIF
	IF MSB("Allow addition of new Text Name "+ALLTRIM(THIS.DisplayValue)+"?",4+256,"That Text Name does not currently exist.") != 6
		RETURN .F.
	ELSE
		THIS.AddItem(THIS.Text)
	ENDIF
ENDIF
RETURN .T.




The AddItem does not add the item to the dropdown, and the field goes blank.

I know this can be done. Where am I going wrong?

KTB

COMPLETE THREAD

Combo.AddItem(THIS.Text) does not work Posted by Ken Blum @ 4/30/2003 8:18:58 PM
Adjust Array Manually Posted by Ken Blum @ 4/30/2003 9:46:54 PM