Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
数据录入窗口,如何在确认输入的时候自动清楚现在的填入数值!以便接下的输入!
笨方法:
e.Form.Controls("TextBox1").Value = Nothing
e.Form.Controls("TextBox2").Value = Nothing
笨方法:
e.Form.Controls("TextBox1").Value = Nothing
e.Form.Controls("TextBox2").Value = Nothing
有聪明点的方法不?
这样,不管控件多少个,都只需三行代码
Dim nms() As string = {"控件一", "控件2", "控件三","控件n"}
For each nm as string in nms
e.form.Controls(nm).value = nothing
next
帮助里:
For Each c As WinForm.Control In e.Form.Controls
If Typeof c Is WinForm.TextBox Then '判断控件是否是文本框
Dim t As WinForm.TextBox = c '使用特定类型的变量引用控件
t.Value = Nothing
End If
Next
这样,不管控件多少个,都只需三行代码
Dim nms() As string = {"控件一", "控件2", "控件三","控件n"}
For each nm as string in nms
e.form.Controls(nm).value = nothing
next
嗯这个方法不错,谢谢老爹.
帮助里:
For Each c As WinForm.Control In e.Form.Controls
If Typeof c Is WinForm.TextBox Then '判断控件是否是文本框
Dim t As WinForm.TextBox = c '使用特定类型的变量引用控件
t.Value = Nothing
End If
Next
这方法非常好,十分感谢,学习了!