[此贴子已经被作者于2023-8-30 13:19编辑过]
************************************************** *-- Form: form1 (d:\documents\visual foxpro 项目\表单变量\表单1.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 08/29/23 08:38:00 PM * PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form Top = 88 Left = 85 Height = 329 Width = 509 DoCreate = .T. Caption = "Form1" Name = "Form1" ADD OBJECT pageframe1 AS pageframe WITH ; ErasePage = .T., ; PageCount = 4, ; Top = 108, ; Left = 36, ; Width = 444, ; Height = 204, ; Name = "Pageframe1", ; Page1.Caption = "Page1", ; Page1.Name = "Page1", ; Page2.Caption = "Page2", ; Page2.Name = "Page2", ; Page3.Caption = "Page3", ; Page3.Name = "Page3", ; Page4.Caption = "Page4", ; Page4.Name = "Page4" ADD OBJECT text1 AS textbox WITH ; Alignment = 3, ; Value = 0, ; Height = 25, ; InputMask = "", ; Left = 97, ; Top = 12, ; Width = 96, ; Name = "Text1" ADD OBJECT label1 AS label WITH ; AutoSize = .T., ; Caption = "输入编号", ; Height = 16, ; Left = 24, ; Top = 20, ; Width = 50, ; Name = "Label1" ADD OBJECT combo1 AS combobox WITH ; RowSourceType = 1, ; RowSource = "202301,202302,202303,202304,202305,202306,202307,202308,202309,202310,202311,202312", ; Height = 25, ; Left = 96, ; Top = 60, ; Width = 97, ; Name = "Combo1" ADD OBJECT combo2 AS combobox WITH ; RowSourceType = 1, ; RowSource = "202301,202302,202303,202304,202305,202306,202307,202308,202309,202310,202311,202312", ; Height = 25, ; Left = 276, ; Top = 60, ; Width = 97, ; Name = "Combo2" ADD OBJECT label2 AS label WITH ; Caption = "起始时间", ; Height = 13, ; Left = 24, ; Top = 65, ; Width = 61, ; Name = "Label2" ADD OBJECT label3 AS label WITH ; Caption = "终止时间", ; Height = 13, ; Left = 204, ; Top = 65, ; Width = 61, ; Name = "Label3" ADD OBJECT command1 AS commandbutton WITH ; Top = 36, ; Left = 432, ; Height = 25, ; Width = 61, ; Caption = "关闭", ; Name = "Command1" ADD OBJECT label4 AS label WITH ; Caption = "Label4", ; Height = 25, ; Left = 240, ; Top = 12, ; Width = 157, ; Name = "Label4" *!* PROCEDURE Activate *!* PUBLIC nText,ST,ET *!* *!* public 声明的变量要释放,不然表单关闭了,它们依然存在。 *!* * nText=0 *!* nText= thisform.TEXT1.value &&此值本来就是0,跟上一句是重复的 *!* st = *!* et = *!* *!* 注意到你对3个变量赋值 *!* ENDPROC PROCEDURE pageframe1.Click *!* 不明白为什么又要再赋值一次,如果要赋值,那么上面activate事件就是多余的。 * nText = thisform.text1.value * st = * et = PUBLIC nText,ST,ET *!* public 声明的变量要释放,不然表单关闭了,它们依然存在。 * nText=0 nText= thisform.TEXT1.value &&此值本来就是0,跟上一句是重复的 st = = *!* 注意到你对3个变量赋值 ENDPROC PROCEDURE pageframe1.Page1.Click * this.parent.click() thisform.pageframe1.page1.caption=STR(NTEXT) ThisForm.Refresh ENDPROC PROCEDURE pageframe1.Page2.Click * this.parent.click() thisform.pageframe1.page2.caption=st ThisForm.Refresh ENDPROC PROCEDURE pageframe1.Page3.Click * this.parent.click() thisform.pageframe1.page3.caption=ET ThisForm.Refresh ENDPROC PROCEDURE pageframe1.Page4.Click * this.parent.click thisform.pageframe1.page4.caption=ET+ST ThisForm.Refresh ENDPROC *!* PROCEDURE text1.LostFocus *!* thisform.label4.caption=str(ntext) *!* ThisForm.Refresh *!* ENDPROC PROCEDURE command1.Click *!*退出前释放public申明过的变量 CLEAR MEMORY clear quit ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************非常感谢!!!