那你就检测然后提示或者return啊。
If Tables("weixin").Current.IsNull("shuliang")=True '判断是否不符合验证要求
MessageBox.Show("商城为空,请输入或者删除行") '提示用户
Else
Dim Index As Integer
Dim Row As DataRow = DataTables("weixin").Find("shuliang is null")
If Row IsNot Nothing Then
msgbox("数量有空值")
Index = Tables("weixin").FindRow(Row) '找出此行在销售数据Table中的位置
If Index > -1 Then '如果找到此行
Tables("weixin").Position = Index '将焦点定位到此行
End If
Return
End If
MainTable = Tables("product") '选择销售数据表作为主表.
End If
MainTable = Tables("product")
Tables("weixindanhao").addnew()