VFP修改记录表单 事件代码

2025-05-05 05:33:14
推荐回答(1个)
回答1:

1. 不推荐对字符字段使用 Editbox 控件, 最好用 TextBox
2. 如果你使用数据绑定的话就容易, 直接使用下列语句, 且修改按钮是不起作用的, 因为系统会自动保存.

2.1 上一个:
If !bof()
skip -1
endif
thisform.refresh

2.2. 下一个
if !eof()
skip
endif
thisform.refresh

2.3. 第一个
go top
thisform.refresh

2.4. 最后一个
go bottom
thisform.refresh

3. 如果你没有数据绑定的话, 就比较麻烦一点.
3.1. 上一条
if !eof()
skip
endif
this.edit1.value = xs1.xh
this.edit2.value = xs1.xm
this.edit3.value = xs1.xb
this.edit4.value = xs1.zy

3.2 其它按钮类似

3.3 修改按钮
try
with thisform
replace xs1.xh with alltr(.edit1.value), xs1.xm with alltr(.edit2.value), xs1.xb with alltrim(.edit3.value), xs1.zy with alltr(.edit4.value)
endwith
messageb("数据修改成功!")
catch
messageb("数据修改失败, 原因: " + message())
Endtry

4. 推荐使用 事务处理, 或者缓冲.

Derek Shu