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

1

本文介绍了文本框被一个巨大的字符串禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

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

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

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14