文字框为空 [英] Text Box empty

查看:66
本文介绍了文字框为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我的查询是我正在VB.Net中开发一个桌面应用程序.在50多个文本框,组合框,富文本框等中输入后,我希望将所有文本框清除为empry,而不是输入textbox.text ="的命令. Bcoz这是一个漫长的过程.

请指导我如何用一个命令清除所有文本框的文本.

Jatinder gupta.

Dear All,

My query is I''m developing a Desk Top application in VB.Net. After entry in more than 50 Text boxes,combo box, rich text box & so on I want that clear all the textbox as empry instead of putting the command of textbox.text=" ". Bcoz it a Lengthy process.

Pl guide me how to clear the text of all the textbox with a single command.

Jatinder gupta.

推荐答案

你好!
所有从控件类派生的控件以及任何控件都具有属性文本.
此代码用于将窗体中的所有控件重置为空文本
Hello!
all the controls derived from Control Class and any control has the property text.
this code for reset all controls in form to empty text
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    For Each ctrl As Control In Me.Controls
        ctrl.Text = ""
    Next
End Sub



您可以使用String.Empty代替"



you can use String.Empty instead of ""


看看: ^ ]

它是用C#语言编写的,但是您会想到一种可能的简便方法.
Have a look at this: Reset all controls on form (Windows forms – C#)[^]

It''s in C#, but you will get an idea of possible easy way.


这篇关于文字框为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆