如何禁用C#中的部分文本框? [英] how to disable part of textbox in C#?

查看:84
本文介绍了如何禁用C#中的部分文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个显示日期的文本框.我用用户从组合框中选择的月份和年份填充日期.而用户只需填写日期.

我可以禁用一些显示月份和年份的文本框吗?

解决方案

你好

不确定我对100%的了解是什么
但是如果您想在用户输入一些新文本的同时在文本框中看到选定的日期时间,则可以在文本框上的textchange事件中始终将文本框的文本设置为喜欢. Textbox.Text =组合的日期时间" + e.char


不带标准文本框,编号
您可以派生一个自定义的文本框,自己动手做,但是要正确完成将需要做大量的工作-创建一个显示用户可以编辑日期的月份和年份的用户控件会容易得多.


hi
i have one text box that shows date.i fill it with the month and year that user choose from combo box.and the user just fill the day.

can i disable some of the textbox that show month and year?
how?

解决方案

Hello

not sure I understand in 100%
but if you want to see selected datetime in textbox while user enter some new text, you can on textbox textchange event always set textbox text like. Textbox.Text = "datetime from combo" + e.char


Not with a standard textbox, no.
You could derive a custom textbox and do it yourself, but it would be a fair amount of work to get right - it would be a lot easier to create a usercontrol that displayed the month and year with a user editable day.


这篇关于如何禁用C#中的部分文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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