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
这篇关于文本框被一个巨大的字符串禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:文本框被一个巨大的字符串禁用


基础教程推荐
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01