你再运行下面的程序看看:
程序代码:
SET DEFAULT TO "E:\My Documents\Visual FoxPro Projects\q497968586"
CLEAR ALL
CLOSE DATABASES ALL
CLEAR
USE student IN 0
USE grade ORDER 学号 IN 0
SELECT student
SET RELATION TO 学号 INTO grade
GOTO TOP
Form1 = CREATEOBJECT("C_Form")
Form1.Show
READ EVENTS
CLOSE DATABASES ALL
RETURN
DEFINE CLASS C_Form AS Form
Caption = "q497968586的问题"
Width = 700
Height = 400
AutoCenter = .T.
ADD OBJECT Grid1 AS Grid WITH Top = 5, Left = 5, Height = 200, Width = 300
ADD OBJECT Grid2 AS Grid WITH Top = 5, Left = 310, Height = 200, Width = 300
PROCEDURE Init
WITH ThisForm
.SetAll("HighlightStyle", 2, "Grid")
.SetAll("RecordSourceType", 1, "Grid")
WITH .Grid1
.ColumnCount = FCOUNT("student")
.RecordSource = "student"
ENDWITH
WITH .Grid2
.ColumnCount = FCOUNT("grade")
.RecordSource = "grade"
ENDWITH
ENDWITH
ENDPROC
PROCEDURE Destroy
CLEAR EVENTS
ENDPROC
ENDDEFINE