以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=71216)

--  作者: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

用这样的代码筛选,试用后,不知道怎样显示全部了,呵呵,求教


--  作者:大红袍
--  发布时间:2015/7/7 15:25:00
--  

什么意思?什么时候显示全部?

 

DataTables("物料中心").LoadFilter=""
DataTables("物料中心").Load


--  作者:yaojun
--  发布时间:2015/7/7 15:35:00
--  

筛选后就只有所筛选的行了,我要增加一按钮,名为显示全部,按下就显示出全部的内容,抱歉,没有说清楚

按照上面的代码可以了,谢谢老师

[此贴子已经被作者于2015/7/7 15:38:23编辑过]

--  作者:大红袍
--  发布时间:2015/7/7 15:36:00
--  

DataTables("物料中心").LoadFilter=""
DataTables("物料中心").Load