Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共7 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:如何清除窗口已经录入数据?(已解决)

1楼
YDS 发表于:2011/5/27 17:26:00

数据录入窗口,如何在确认输入的时候自动清楚现在的填入数值!以便接下的输入!

[此贴子已经被作者于2011-6-13 8:38:40编辑过]
2楼
狐狸爸爸 发表于:2011/5/27 17:38:00

笨方法:

 

e.Form.Controls("TextBox1").Value = Nothing
e.Form.Controls("TextBox2").Value = Nothing

[此贴子已经被作者于2011-5-27 17:38:20编辑过]
3楼
YDS 发表于:2011/5/27 18:53:00
以下是引用狐狸爸爸在2011-5-27 17:38:00的发言:

笨方法:

 

e.Form.Controls("TextBox1").Value = Nothing
e.Form.Controls("TextBox2").Value = Nothing

[此贴子已经被作者于2011-5-27 17:38:20编辑过]

 

有聪明点的方法不?

4楼
狐狸爸爸 发表于:2011/5/27 19:28:00

这样,不管控件多少个,都只需三行代码

 

Dim nms() As string  = {"控件一", "控件2", "控件三","控件n"}

For each nm as string in nms

   e.form.Controls(nm).value = nothing

next

5楼
blackzhu 发表于:2011/5/27 19:51:00

帮助里:

 

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

6楼
YDS 发表于:2011/5/28 9:04:00
以下是引用狐狸爸爸在2011-5-27 19:28:00的发言:

这样,不管控件多少个,都只需三行代码

 

Dim nms() As string  = {"控件一", "控件2", "控件三","控件n"}

For each nm as string in nms

   e.form.Controls(nm).value = nothing

next

 

嗯这个方法不错,谢谢老爹.

7楼
YDS 发表于:2011/5/28 9:05:00
以下是引用blackzhu在2011-5-27 19:51:00的发言:

帮助里:

 

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

 

这方法非常好,十分感谢,学习了!

共7 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03125 s, 2 queries.