PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN ************************************************** *-- Form: form1 (c:\program files\microsoft visual foxpro 9\test.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 06/13/05 09:24:00 PM * DEFINE CLASS form1 AS form Top = 51 Left = 267 DoCreate = .T. Caption = "Form1" Name = "Form1" ADD OBJECT combo1 AS combobox WITH ; Height = 24, ; Left = 18, ; Top = 30, ; Width = 100, ; Name = "Combo1" ADD OBJECT command1 AS commandbutton WITH ; Top = 34, ; Left = 168, ; Height = 27, ; Width = 84, ; Caption = "APPEND", ; Name = "Command1" ADD OBJECT command2 AS commandbutton WITH ; Top = 64, ; Left = 169, ; Height = 27, ; Width = 84, ; Caption = "INSERT", ; Name = "Command2" PROCEDURE Load m1 = "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8" CREATE CURSOR cTest (cRewind C(2)) c1 = ALINES(aaa,m1,7,",") FOR asd = 1 TO c1 INSERT INTO cTest VALUES (aaa[asd]) NEXT BROWSE NORMAL GO TOP ENDPROC PROCEDURE Init WITH thisform.Combo1 .Style= 2 .RowSourceType = 1 .RowSource= "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8" .BoundColumn = 1 .ControlSource = "cRewind" ENDWITH ENDPROC PROCEDURE command1.Click APPEND BLANK REPLACE cRewind WITH "BB" ENDPROC PROCEDURE command2.Click INSERT INTO cTest VALUES ("II") ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************So I suggest you:
*** default code here IF m.vNewVal thisform.Combo1.ControlSource = NULL ELSE thisform.Combo1.ControlSource = "YourTable.cRewind" ENDIFCan the user add more elemts of the list?
PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN ************************************************** *-- Form: form1 (c:\program files\microsoft visual foxpro 9\test.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 06/13/05 09:31:05 PM * DEFINE CLASS form1 AS form Top = 51 Left = 267 DoCreate = .T. Caption = "Form1" lappend = .F. Name = "Form1" ADD OBJECT combo1 AS combobox WITH ; Height = 24, ; Left = 18, ; Top = 30, ; Width = 100, ; Name = "Combo1" ADD OBJECT command1 AS commandbutton WITH ; Top = 34, ; Left = 168, ; Height = 27, ; Width = 84, ; Caption = "APPEND", ; Name = "Command1" ADD OBJECT command2 AS commandbutton WITH ; Top = 64, ; Left = 170, ; Height = 27, ; Width = 84, ; Caption = "SAVE", ; Name = "Command2" PROCEDURE lappend_assign LPARAMETERS vNewVal *To do: Modify this routine for the Assign method THIS.lAppend = m.vNewVal IF m.vNewVal thisform.Combo1.ControlSource = NULL ELSE thisform.Combo1.ControlSource = "cTest.crewind" ENDIF ENDPROC PROCEDURE Init WITH thisform.Combo1 .Style= 2 .RowSourceType = 1 .RowSource= "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8" .BoundColumn = 1 .ControlSource = "cRewind" ENDWITH ENDPROC PROCEDURE Load m1 = "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8" CREATE CURSOR cTest (cRewind C(2)) c1 = ALINES(aaa,m1,7,",") FOR asd = 1 TO c1 INSERT INTO cTest VALUES (aaa[asd]) NEXT BROWSE NORMAL GO TOP ENDPROC PROCEDURE command1.Click thisform.lAppend = .t. APPEND BLANK ENDPROC PROCEDURE command2.Click REPLACE cRewind WITH thisform.Combo1.Value thisform.lAppend = .f. BROWSE NORMAL ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************