老师好,为甚么清空db2的值之后,一直报错呢?怎么设条件都不行啊
Dim cmb As WinForm.ComboBox = e.Form.Controls("移动类型ComboBox2")
Dim cmb1 As WinForm.ComboBox = e.Form.Controls("接收单元ComboBox1")
Dim db1 As WinForm.DropDownBox = e.Sender '定义引用正在发生变化的控件
Dim db2 As WinForm.DropDownBox = e.Form.Controls("移动单元DropBox1")
Dim st As String = db1.Text.SubString(0,4) '取得过账区域项目的值的前四位
Dim str As String = "" ' 在移动的类型表中,查找移动单元包含前四位的行
Dim fiter As DataRow = DataTables("库存查询").Find("[移动单元] = '"& st &"'")
If db1.Value <> "" Or db2.value <> "" Then
cmb.Enabled = True
cmb1.Enabled = True
If fiter Is Nothing Then
db2.Value = Nothing
Tables("转移过账_筛选Table1").Filter = ""
MessageBox.show("选定区域不存在,请重新输入!")
Else Tables("转移过账_筛选Table1").Filter = ("[移动单元] = '"& st &"'")
End If
For Each dr As DataRow In DataTables("移动类型").Select("'|' + [移动单元] + '|' like '%|" & st & "|%'")
str += dr("移动代码") & "-" & dr("移动文本") & "|" ''空白+代码,用-连接移动文本,后面的以此用|连接成一个字符串
Next
cmb.combolist = str.Trim("|") ''删除多余连接的|
cmb.value = Nothing
cmb1.value = Nothing
Else
cmb.value = Nothing
cmb1.value = Nothing
cmb.Enabled = False
cmb1.Enabled = False
End If