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