老师当我输入的值不等于yh(“所属部门”)时提示“未将对象引用设置到对象的实例。”
我的代码时希望弹出提示框“溯源码不可用”;请老师看下代码有何错误
代码如下:
If e.KeyCode = Keys.ENTER Then
****省略代码
If t.length <> 19 Then
***省略代码
Else
Dim fr As DataRow = DataTables("溯源码").SQLFind("当前所在部门 = '" & yh("所属部门") & "' And 子溯源码 like '" & t & "%' and len(子溯源码)='" & t.length+1 & "'" ) '溯源码表中的溯源码是否存在与盘点单据
If fr IsNot Nothing And fr("是否可用") = True Then
***省略代码
DataTables("外部出库").Save()
e.Form.Controls("TextBox1").value = Nothing
e.Form.Controls("textbox1").Select()
Else
MessageBox.Show("溯源码不可用!", "提示")
End If
End If
End If