-- 作者:yaojun
-- 发布时间:2015/7/7 14:30:00
-- 请教
Dim cpbh As String = e.Form.Controls("编号").value Dim cxtj As String = e.Form.Controls("ComboBox1").value Dim dr,dr1 As DataRow If cxtj = "物料编号" AndAlso cpbh = "" Then e.Form.Controls("物料编号").Text = "未知" e.Form.Controls("物料名称").Text = "未知" e.Form.Controls("所用产品").Text = "未知" e.Form.Controls("库存数量").Text = "未知" MessageBox.Show("请输入物料编号,不能留空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning) ElseIf cxtj = "物料名称" AndAlso cpbh = "" Then e.Form.Controls("物料编号").Text = "未知" e.Form.Controls("物料名称").Text = "未知" e.Form.Controls("所用产品").Text = "未知" e.Form.Controls("库存数量").Text = "未知" MessageBox.Show("请输入物料名称,不能留空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning) ElseIf cxtj = "物料编号" AndAlso cpbh <> "" Then DataTables("物料中心").LoadFilter=" [物料编号] = \'" & cpbh & "\'" DataTables("物料中心").Load dr = DataTables("物料中心").Find("[物料编号] = \'" & cpbh & "\' ") If dr Is Nothing Then MessageBox.Show("暂未查询到该物料编号所对应的物料,请检查是否输错!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Warning) Else e.Form.Controls("物料编号").Text = dr("物料编号") e.Form.Controls("物料名称").Text = dr("物料名称") e.Form.Controls("所用产品").Text = dr("所用产品") e.Form.Controls("库存数量").Text = dr("库存数量") End If ElseIf cxtj = "物料名称" AndAlso cpbh <> "" Then DataTables("物料中心").LoadFilter=" [物料名称] = \'" & cpbh & "\'" DataTables("物料中心").Load dr1 = DataTables("物料中心").Find("[物料名称] = \'" & cpbh & "\' ") If dr1 Is Nothing Then MessageBox.Show("系统中没有对应的物料名称,请检查是否输错!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Warning) Else e.Form.Controls("物料编号").Text = dr1("物料编号") e.Form.Controls("物料名称").Text = dr1("物料名称") e.Form.Controls("所用产品").Text = dr1("所用产品") e.Form.Controls("库存数量").Text = dr1("库存数量") End If End If
用这样的代码筛选,试用后,不知道怎样显示全部了,呵呵,求教
|