请教:下面是张洪举VFP9中的用类定义写的代码为什么不能运行?
附件
program3.rar
(1.47 KB)
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- Form: form1 (d:\vfp8jc\基础篇\10\software\10.3.15\form6.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 01/29/04 05:14:10 PM
*
DEFINE CLASS form1 AS form
Top = 0
Left = 0
Height = 231
Width = 406
DoCreate = .T.
Caption = "单击列标头排序示例"
Name = "form1"
ADD OBJECT form1.grid1 AS grid WITH ;
ColumnCount = 7, ;
ChildOrder = "语文成绩", ;
DeleteMark = .F., ;
Height = 189, ;
Left = 6, ;
Panel = 1, ;
RecordMark = .F., ;
RecordSource = "tblstudent", ;
SplitBar = .F., ;
Top = 6, ;
Width = 390, ;
GridLineColor = RGB(128,128,128), ;
LockColumns = 2, ;
Name = "Grid1", ;
Column1.ControlSource = "tblstudent.学号", ;
Column1.Width = 59, ;
Column1.Name = "Column1", ;
Column2.ControlSource = "tblstudent.姓名", ;
Column2.Width = 62, ;
Column2.Name = "Column2", ;
Column3.ControlSource = "tblstudent.学期", ;
Column3.Width = 54, ;
Column3.Name = "Column3", ;
Column4.ControlSource = "tblstudent.语文成绩", ;
Column4.Width = 71, ;
Column4.Name = "Column4", ;
Column5.ControlSource = "tblstudent.数学成绩", ;
Column5.Width = 67, ;
Column5.Name = "Column5", ;
Column6.ControlSource = "tblstudent.英语成绩", ;
Column6.Width = 90, ;
Column6.Name = "Column6", ;
Column7.ControlSource = "tblstudent.总成绩", ;
Column7.Width = 90, ;
Column7.Name = "Column7"
ADD OBJECT form1.grid1.column1.header1 AS header WITH ; **提示语法错误,以下只要是add object from1.grid1.column..... with 都提示语法错误
Caption = "学号", ;
Name = "Header1"
ADD OBJECT form1.grid1.column1.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column2.header1 AS header WITH ;
Caption = "姓名", ;
Name = "Header1"
ADD OBJECT form1.grid1.column2.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column3.header1 AS header WITH ;
Caption = "学期", ;
Name = "Header1"
ADD OBJECT form1.grid1.column3.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column4.header1 AS header WITH ;
Caption = "语文成绩", ;
Picture = "up.bmp", ;
Name = "Header1"
ADD OBJECT form1.grid1.column4.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column5.header1 AS header WITH ;
Caption = "数学成绩", ;
Name = "Header1"
ADD OBJECT form1.grid1.column5.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column6.header1 AS header WITH ;
Caption = "英语成绩", ;
Name = "Header1"
ADD OBJECT form1.grid1.column6.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column7.header1 AS header WITH ;
Caption = "总成绩", ;
Name = "Header1"
ADD OBJECT form1.grid1.column7.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 201, ;
Left = 285, ;
Height = 25, ;
Width = 94, ;
Caption = "关闭(\<C)", ;
Name = "Command1"
PROCEDURE header1.Click
LOCAL lnRecno
lnRecno=IIF(EOF() OR BOF(),1,RECNO()) &&保存当前记录号
IF UPPER(JUSTSTEM(This.Picture))="UP"
This.Picture="Down.bmp"
SET ORDER TO 语文成绩 DESCENDING &&降序排列
ELSE
This.Picture="Up.bmp"
SET ORDER TO 语文成绩 ASCENDING &&升序排列
ENDIF
Thisform.Refresh
GO lnRecno
ENDPROC
PROCEDURE command1.Click
RELEASE Thisform
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************
[ 本帖最后由 sylknb 于 2012-11-29 12:41 编辑 ]