将值设置为textbox属性,但不在该文本框中显示该值 [英] set a value to textbox property but do not display that value in that textbox

查看:116
本文介绍了将值设置为textbox属性,但不在该文本框中显示该值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经为文本框编写了get set属性,我想为文本框的属性分配值,但不应在该文本框中显示它,可以这样做吗?
这是针对Windows窗体应用程序的

例如:-

如果MYtext是textbox1的属性;
我将为其赋值Mytext = 3;
它不应显示在该文本框中.

问候,
-G-

Hi,

i have written get set property for a textbox,i want to assign value to the property of textbox but it should not be displayed in that textbox,can this be done?
this is for windows form application

eg:-

if MYtext is property for textbox1;
i will assign value to it Mytext=3;
it should not be displayed in that textbox.

Regards,
-G-

推荐答案

如果您不希望显示该值,然后使用"Tag"属性临时保存该值

如下分配值

If you do not want the value to be displayed and then use the "Tag" property to hold the value temperavorily

Assign the value as follows

txtFind.Tag = "1233";




如果要显示值




If you want to show the value

txtFind.Text = txtFind.Tag.ToString() ;




如果要隐藏




if you want to hide

txtFind.Text = "" ;




不确定,"Tag"属性可以保存的数据长度.....为了安全起见,为此只需要在Google上搜索一下,或者对此发表一些评论即可




Not sure, the length of the data the "Tag" property can hold.....just do a google on this for the safe side or some one comment on this


visible选项设置为false,您的文本框也将不可见.如果在属性窗口中分配密码char,则该char将可见,而不是您的值.

示例:实际值:xyz
文本框显示:***
If you make visible option to false, your textbox will not be visible too. If you assign a password char in the properties window, that char will be visible instead of your value.

example: actual value: xyz
textbox shows: ***


您可以在Visual Studio中将textbox属性中的可见选项设置为false,这不会使您的值在文本框中回显.
You can make a visible option in textbox property to false in visual studio this will not make your value echo in the text box.


这篇关于将值设置为textbox属性,但不在该文本框中显示该值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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