当前位置: 代码迷 >> PB >> null Object reference解决方法
  详细解决方案

null Object reference解决方法

热度:62   发布时间:2016-04-29 08:46:34.0
null Object reference
//设置margin
string ls_dataobject,ls_name
////保存位置
string ls_dwo
string ls_left,ls_top,ls_right,ls_bottom

if not isvalid(dw) or isnull(dw) or len(dw.dataobject)=0 then return

int li_count
ls_dataobject = dw.dataobject
ls_name =dw.classname()
ls_left =dw.Object.DataWindow.Print.Margin.Left
执行到最后一句报错

------解决方案--------------------
改成
ls_left =dw.describe("DataWindow.Print.Margin.Left")
试试

------解决方案--------------------
判断DW 或DS 指定的 DW对象 是否有效,试试:

if not IsValid(dw.Object) then return 
  相关解决方案