文本框被一个巨大的字符串禁用

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

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)