以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]关于代码的简化 谢谢 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=62768) |
-- 作者:as2517 -- 发布时间:2015/1/7 18:08:00 -- [求助]关于代码的简化 谢谢 e.Form.Controls("Label5").Visible =True e.Form.Controls("Label6").Visible =True e.Form.Controls("Label7").Visible =True e.Form.Controls("Label8").Visible =True e.Form.Controls("TextBox1").Visible =True e.Form.Controls("TextBox2").Visible =True e.Form.Controls("TextBox3").Visible =True e.Form.Controls("TextBox4").Visible =True 老师看看这段代码能简化么? 下面这样写可以么,还有好点的么 Dim T As String() = {"Label5","Label6","Label7","Label8","TextBox1","TextBox2","TextBox3","TextBox4"} For n As Integer = 0 To 7 e.Form.Controls(T(n)).Visible = True Next [此贴子已经被作者于2015-1-7 18:14:50编辑过]
|
-- 作者:有点甜 -- 发布时间:2015/1/7 18:16:00 -- 看一下
http://www.foxtable.com/help/topics/0216.htm
http://www.foxtable.com/help/topics/0226.htm
|