Textbox disabled with a huge string(文本框被一个巨大的字符串禁用)
问题描述
textbox
在输入大字符串时遇到问题.
I'm having a issue with a textbox
when it's typed a huge string.
在我的例子中,文本框用于编写电子邮件地址,并且没有字符限制.所以,我做了这个测试:我在记事本中写了 200 个电子邮件地址,然后我将文本粘贴到 textbox
上,文本消失了,但是如果我改变控件的焦点,文本再次显示.我已经看到了这个 链接,但它没有帮助我.我已经尝试将 MaxLength
属性更改为 0 (微软说怎么做),但在这里也不起作用.
In my case, the textbox is used to write email addresses, and it doesn't have a limit of chars. So, I've made this test: I wrote 200 email addresses in a notepad, and I pasted the text on the textbox
and the text disappeared, but if I change the focus of the control, the text is displayed again. I already saw this link, but it doesn't helped me. I already tried to change the MaxLength
property to 0 (how the microsoft says to do), but it doesn't worked here too.
考虑到一个包含 50 个字符的电子邮件地址,MaxLength 属性不会有问题,因为 200 个电子邮件地址乘以 50 个字符(每封电子邮件),我将有 10000 个字符,并且 TextBox 的默认值.MaxLength
为 32767.
Considering a email address with 50 chars, the MaxLength property wouldn't be a problem, because 200 email addresses multiplying with 50 chars (each email), I'll have 10000 chars, and the default value of TextBox.MaxLength
is 32767.
而且,在你询问代码之前,我只将文本设置为字符串.
And, before you ask for the code, I only set the text to a string.
myEmailObject.Address = txtEmail.Text;
我应该使用 RichText
还是什么?
Should I use RichText
, or what?
推荐答案
尝试将 Multiline 属性设置为 True 并增加文本框的高度
Try to set the Multiline property to True and increase the height of the textbox
这篇关于文本框被一个巨大的字符串禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:文本框被一个巨大的字符串禁用


- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- 使用 rss + c# 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01