用dw_1.FINDREQUIRED()函数来检测。本函数只能和datawindow控件一起使用。函数具体用法如下:
Reports the next row and column that is required and contains a NULL value. The method arguments that specify where to start searching also store the results of the search. You can speed up the search by specifying that FindRequired check only inserted and modified rows.
例子如下:
long ll_row = 1
假设学号字段名称为cardid,在数据窗口的itemchanged事件中写:
string ls_cardid
accepttext()
if dwo.name = 'cardid' then
ls_cardid = string(data)
if isnull(ls_cardid) or ls_cardid = '' then
messagebox('提示','学号不能为空,请重新输入学号')
return 1
end if
end if
ls_htmc=dw_1.getitemstring(dw_1.getrow(),'htmc')
if ls_htmc='' or isnull(ls_htmc) then //判断htmc是否为空
messagebox('提示信息','请输入合同名称!') //提示
dw_1.setfocus()
dw_1.setcolumn('htmc') //焦点返回
return //中断操作
end if
ls_htmc=dw_1.getitemstring(dw_1.getrow(),'htmc')
if ls_htmc='' or isnull(ls_htmc) then //判断htmc是否为空
messagebox('提示信息','请输入合同名称!') //提示
dw_1.setfocus()
dw_1.setcolumn('htmc') //焦点返回
return //中断操作
end if