PUBLIC obaseform1 obaseform1=NEWOBJECT("BaseForm1") obaseform1.Show RETURN DEFINE CLASS baseform1 AS Form Top = 0 Left = 0 Height = 343 Width = 342 DoCreate = .T. Name = "Baseform1" ADD OBJECT list1 AS listbox WITH ; Height = 328, ; Left = 5, ; Top = 13, ; Width = 188, ; Name = "List1" ADD OBJECT text1 AS textbox WITH ; ControlSource = "", ; Height = 23, ; Left = 198, ; Top = 16, ; Width = 141, ; Name = "Text1" PROCEDURE Init thisform.AddObject("testCollection","Collection") WITH thisform.testCollection FOR i = 1 TO 15 .Add(REPLICATE(CHR(65+i),5),"Key"+TRANSFORM(i)) NEXT ENDWITH thisform.List1.RowSourceType= 10 thisform.List1.RowSource = "thisform.testCollection" thisform.List1.ListIndex = 1 thisform.ChangeControls(1) ENDPROC PROCEDURE list1.InteractiveChange thisform.ChangeControls(this.ListIndex) ENDPROC PROCEDURE text1.LostFocus IF this.Tag # this.Value thisform.testCollection.Remove(thisform.List1.ListIndex) thisform.testCollection.Add(this.Value,"Key"+TRANSFORM(thisform.List1.ListIndex),thisform.List1.ListIndex) thisform.List1.Requery() ENDIF ENDPROC PROCEDURE ChangeControls(iIndex) thisform.text1.Value = thisform.testCollection.Item(iIndex) ENDPROC PROCEDURE text1.GotFocus this.Tag = this.Value ENDPROC ENDDEFINE * *-- EndDefine: baseform1 **************************************************