以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助] For Each (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=94872) |
-- 作者:yupeng -- 发布时间:2017/1/4 13:34:00 -- [求助] For Each Dim wk() As String = {"类别","名称","单价","单位","空差"} esle 代码2 next
老师 这段代码 在所有控件都是空值正常执行代码2 当“类别”不是空值时,它先执行了代码1 再执行代码2
怎样改成 所有控件都不是空值才执行代码1?
谢谢 [此贴子已经被作者于2017/1/4 14:09:21编辑过]
|
-- 作者:有点色 -- 发布时间:2017/1/4 14:32:00 -- Dim wk() As String = {"类别","名称","单价","单位","空差"} Dim allNotNull As Boolean = True For Each i As String In wk If e.Form.Controls(i).Value Is Nothing Then allNotNull = False Exit For End If Next If allNotNull Then \'代码1 Else \'代码2 End If |