你都已经开始调试了,既然没有出现MessageBox之前,就提示错误,你就将MessageBox往前面移动。
其实这种错误,都是自己编码不严谨,不做基本的条件判断造成的,正常应该这样:
If e.DataCol.name="color" AndAlso Tables("newmoo_product").Current IsNot Nothing Then
e.DataRow("pic")="upfile1/pic/" & e.DataRow("ppp")
Dim s As String = Tables("newmoo_product").Current("ppp")
If s > "" Then
s=filesys.GetName(s) '得到的是 asss.jpg
e.DataRow("tao") = s.SubString(0,s.LastIndexOf(".")) & ":1:0:|;"
e.DataRow("tao1") = s.SubString(0,s.LastIndexOf("."))
e.DataRow("cn_name")= e.DataRow("tao1")
End If
End If
If e.DataCol.Name = "costPrice" Then
If e.DataRow("costPrice") Then
'e.DataRow("salePrice")= e.DataRow("costPrice") * 2 /170
End If
End If
没有这些判断,那么如果没有当前行呢,如果s为空呢,如果编辑的不是costPrice呢? 前面两个如果会导致出错,后面这个如果会导致没有必要的重复计算。
其实编程么有什么技巧可言的,特别是在foxtable中编程。