oForm = createobject('listsearch') oForm.Show(1) DEFINE CLASS listsearch AS form DoCreate = .T. Caption = "Form1" Name = "listsearch" ADD OBJECT list1 AS listbox WITH ; RowSourceType = 1, ; RowSource = "a,b,c,d,e,f,g,h", ; Height = 170, ; Left = 60, ; Top = 60, ; Width = 240, ; Name = "List1" ADD OBJECT text1 AS textbox WITH ; Height = 23, ; Left = 60, ; Top = 12, ; Width = 240, ; Name = "Text1" PROCEDURE text1.KeyPress LPARAMETERS nKeyCode, nShiftAltCtrl if nKeyCode = 13 thisform.list1.value = this.value if thisform.list1.listindex = 0 messagebox('Value not found') endif endif ENDPROC ENDDEFINE