求助:关于表修改的问题
新手求教。问题1 如图,如何实现鼠标点到左表任一记录,在右侧文本框中对应显示相应记录,而不是用上一条或下一条记录挨个翻。
问题2 当我任选一条记录删除后,左表显示空白,如何在删除后让左表显示正常数据。
请各位大神帮忙找一下问题所在,谢谢!!!
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- Form: form1 (d:\vfp应用\学生成绩管理系统\form\f_user.scx)
*-- 父类: form
*-- 基类: form
*
DEFINE CLASS form1 AS form
Height = 388
Width = 602
DoCreate = .T.
AutoCenter = .T.
Caption = "用户管理"
Name = "Form1"
ADD OBJECT shape2 AS shape WITH ;
Top = 72, ;
Left = 372, ;
Height = 144, ;
Width = 181, ;
BackStyle = 0, ;
SpecialEffect = 0, ;
Name = "Shape2"
ADD OBJECT shape1 AS shape WITH ;
Top = 72, ;
Left = 24, ;
Height = 228, ;
Width = 312, ;
BackStyle = 0, ;
SpecialEffect = 0, ;
Name = "Shape1"
ADD OBJECT grduser AS grid WITH ;
ColumnCount = 3, ;
Height = 200, ;
Left = 42, ;
RecordSource = "user", ;
RecordSourceType = 1, ;
Top = 86, ;
Width = 276, ;
Name = "grdUser", ;
Column1.ControlSource = "user.账号", ;
Column1.Name = "Column1", ;
Column2.ControlSource = "user.真实姓名", ;
Column2.Name = "Column2", ;
Column3.ControlSource = "user.密码", ;
Column3.Name = "Column3"
ADD OBJECT form1.grduser.column1.header1 AS header WITH ;
Caption = "账号", ;
Name = "Header1"
ADD OBJECT form1.grduser.column1.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grduser.column2.header1 AS header WITH ;
Caption = "真实姓名", ;
Name = "Header1"
ADD OBJECT form1.grduser.column2.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grduser.column3.header1 AS header WITH ;
Caption = "密码", ;
Name = "Header1"
ADD OBJECT form1.grduser.column3.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT txt账号 AS textbox WITH ;
Comment = "", ;
ControlSource = "user.账号", ;
Enabled = .T., ;
Height = 20, ;
Left = 456, ;
MaxLength = 10, ;
TabIndex = 3, ;
Top = 93, ;
Width = 72, ;
Name = "txt账号"
ADD OBJECT lbl账号 AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "账 号", ;
Height = 16, ;
Left = 394, ;
Top = 95, ;
Width = 42, ;
TabIndex = 2, ;
Name = "lbl账号"
ADD OBJECT txt真实姓名 AS textbox WITH ;
Comment = "", ;
ControlSource = "user.真实姓名", ;
Enabled = .T., ;
Height = 20, ;
Left = 456, ;
MaxLength = 8, ;
TabIndex = 5, ;
Top = 132, ;
Width = 72, ;
Name = "txt真实姓名"
ADD OBJECT lbl真实姓名 AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "真实姓名", ;
Left = 394, ;
Top = 134, ;
Width = 48, ;
TabIndex = 4, ;
Name = "lbl真实姓名"
ADD OBJECT txt密码 AS textbox WITH ;
Comment = "", ;
ControlSource = "user.密码", ;
Enabled = .T., ;
Height = 20, ;
Left = 456, ;
MaxLength = 10, ;
TabIndex = 7, ;
Top = 169, ;
Width = 72, ;
Name = "txt密码"
ADD OBJECT lbl密码 AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "密 码", ;
Height = 16, ;
Left = 394, ;
Top = 171, ;
Width = 42, ;
TabIndex = 6, ;
Name = "lbl密码"
ADD OBJECT command4 AS commandbutton WITH ;
AutoSize = .F., ;
Top = 312, ;
Left = 504, ;
Height = 30, ;
Width = 60, ;
FontSize = 11, ;
Caption = "退出", ;
Name = "Command4"
ADD OBJECT command3 AS commandbutton WITH ;
AutoSize = .F., ;
Top = 312, ;
Left = 432, ;
Height = 30, ;
Width = 60, ;
FontSize = 11, ;
Caption = "删除", ;
Name = "Command3"
ADD OBJECT command1 AS commandbutton WITH ;
AutoSize = .F., ;
Top = 312, ;
Left = 288, ;
Height = 30, ;
Width = 60, ;
FontSize = 11, ;
Caption = "添加", ;
Name = "Command1"
ADD OBJECT commandgroup1 AS commandgroup WITH ;
AutoSize = .F., ;
ButtonCount = 4, ;
Value = 1, ;
Height = 35, ;
Left = 336, ;
Top = 252, ;
Width = 265, ;
Name = "Commandgroup1", ;
Command1.AutoSize = .F., ;
Command1.Top = 5, ;
Command1.Left = 5, ;
Command1.Height = 25, ;
Command1.Width = 60, ;
Command1.Caption = "首记录", ;
Command1.Name = "Command1", ;
Command2.AutoSize = .F., ;
Command2.Top = 5, ;
Command2.Left = 70, ;
Command2.Height = 25, ;
Command2.Width = 60, ;
Command2.Caption = "末记录", ;
Command2.Name = "Command2", ;
Command3.AutoSize = .F., ;
Command3.Top = 5, ;
Command3.Left = 135, ;
Command3.Height = 25, ;
Command3.Width = 60, ;
Command3.Caption = "上一条", ;
Command3.Name = "Command3", ;
Command4.AutoSize = .F., ;
Command4.Top = 5, ;
Command4.Left = 200, ;
Command4.Height = 25, ;
Command4.Width = 60, ;
Command4.Caption = "下一条", ;
Command4.Name = "Command4"
ADD OBJECT command2 AS commandbutton WITH ;
AutoSize = .F., ;
Top = 312, ;
Left = 360, ;
Height = 30, ;
Width = 60, ;
FontSize = 11, ;
Caption = "插入", ;
Name = "Command2"
PROCEDURE command4.Click
thisform.release
ENDPROC
PROCEDURE command3.Click
delete
pack
thisform.refresh
ENDPROC
PROCEDURE command1.Click
append blank
goto bottom
thisform.refresh
ENDPROC
PROCEDURE
go top
this.enabled=.F.
thisform.refresh
ENDPROC
PROCEDURE
go bottom
this.enabled=.F.
thisform.refresh
ENDPROC
PROCEDURE
skip-1
if bof()
messagebox("已是第一条记录",48,"信息窗口")
this.enabled=.F.
else
this.enabled=.T.
thisform.refresh
endif
ENDPROC
PROCEDURE
skip 1
if eof()
messagebox("已是最后一条记录",48,"信息窗口")
this.enabled=.F.
else
this.enabled=.T.
thisform.refresh
endif
ENDPROC
PROCEDURE command2.Click
insert before blank
thisform.refresh
ENDPROC
ENDDEFINE
*
*-- 结束定义: form1
**************************************************