如何基于文本框宽度和剩余文本拆分文本将在另一个文本框中打印。 [英] How to split the text based on textbox width and remaining text will printe in another textbox.

查看:58
本文介绍了如何基于文本框宽度和剩余文本拆分文本将在另一个文本框中打印。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Haii,





我有两个文本框。我的要求是我在第一个文本框中写了一些字符,如果该文本框已满,则剩余的字符集将显示在下一个文本框中,自动取决于第一个文本框宽度。

Haii,


I have two textboxes. My requirement is i write some charecters in first text box,If that textbox is full,remaining Charecters will be display in next text box automatically depends upon first textbox width.

推荐答案

windows或web?

参考:

1. 文本框如何在c#.net windows应用程序中达到限制时,文本会自动移动到下一个控件吗? [ ^ ]

2. http://forums.asp.net/t/1499402.aspx?to+change+focus+from+one+textbox +到+另一个+文本框+一次+ +最大+字段+长度+到达+ [ ^ ]
windows or web?
Refer:
1. how text box text automatically moving to next control when limit is reached in c# .net windows application?[^]
2. http://forums.asp.net/t/1499402.aspx?to+change+focus+from+one+textbox+to+another+textbox+once+the+max+field+length+reaches+[^]


你需要为第一个文本框设置最大字符限制。例如,如果将限制设置为5个字符,则在第一个文本框的 textChanged 事件中检查它的字符长度,如果它等于5,则设置专注于第二个文本框并继续输入你的文字。



我不知道你正在使用什么技术,即Forms App或ASP .NET,这就是为什么我无法编码。以下是Forms App代码,



You need to set the max character limit for the first textbox. For example, if you set the limit to the 5 chars then on the textChanged event of the first textbox check the char length of it, and if it is equal to 5 then set focus to the second textbox and continue typing your text.

I don't know on what technology you're working on i.e Forms App or ASP .NET, that's why I am not able to code it. Below is the Forms App code,

private void textBox1_TextChanged(object sender, EventArgs e)
{
   if (textBox1.TextLength == 5)  // check for the current chars in the textbox
   {
       textBox2.Focus();
   }
}







希望它会对你有所帮助。 ;)



-KR




Hope it would help you. ;)

-KR


这篇关于如何基于文本框宽度和剩余文本拆分文本将在另一个文本框中打印。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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