textbox1输入满格后自动到textbox2,类推
按tab时从textbox1到textbox4

解决方案 »

  1.   

    textchanged事件中判断一下,4个textbox的TextChanged都注册为一个事件,例如
    public void TextBoxAll_TextChanged(object sender,EventArgs e)
    {
        if((sender as TextBox).Text.Length > 5)//看你自己指定多少个了
        {
            SendKeys.Send("{TAB}");
        }
    }没开vs,如果代码敲错你对照大小写啥的改改。
      

  2.   

            private void Form1_Load(object sender, EventArgs e)
            {
                textBox1.MaxLength = textBox2.MaxLength = textBox3.MaxLength = textBox4.MaxLength = 10;
                textBox1.TextChanged += new EventHandler(OnTextChanged);
                textBox2.TextChanged += new EventHandler(OnTextChanged);
                textBox3.TextChanged += new EventHandler(OnTextChanged);
                textBox4.TextChanged += new EventHandler(OnTextChanged);
            }        private void OnTextChanged(object sender, EventArgs e)
            {
                if ((sender as TextBox).Text.Length >= (sender as TextBox).MaxLength)
                {
                    SendKeys.Send("{TAB}");
                }
            }
      

  3.   

    设置 tabindexprivate void textBox_TextChanged(object sender, EventArgs e)
            {
                TextBox txt=sender as TextBox;
                if (txt.Text.Length >= 6)
                {
                    this.Controls[""].Focus();
                }
            }
    this.ActiveControl = textBox2;
    SendKeys.Send("{TAB}");
      

  4.   

     应该很简单的啊? 判断长度满足有 光标移到下一个textbox控件中
      

  5.   

    这就要看你输入多少字符了 你根据字符长度来判断   如果输入满了  就调用 下一个的Textbox的焦点方法啊  
      

  6.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace Ques_1
    {
        public partial class Form1 : Form
        {
            private const int textSize = 5;//设置你每个textbox输入上限
            public Form1()
            {
                InitializeComponent();
            }
    //这样写不能保证像激活码那样在第一个复制进去全部刚好,要一个个的textbox输入,要是要那种的话,可以采用下面的另一种方式
            private void Form1_Load(object sender, EventArgs e)
            {
                this.textBox1.MaxLength = textSize;
                this.textBox2.MaxLength = textSize;
                this.textBox3.MaxLength = textSize;
                this.textBox4.MaxLength = textSize;
                this.textBox1.TextChanged += new EventHandler(textBox1_TextChanged);
                this.textBox2.TextChanged += new EventHandler(textBox2_TextChanged);
                this.textBox3.TextChanged += new EventHandler(textBox3_TextChanged);
                this.textBox4.TextChanged += new EventHandler(textBox4_TextChanged);
            }        void textBox4_TextChanged(object sender, EventArgs e)
            {
               
            }        void textBox3_TextChanged(object sender, EventArgs e)
            {
                if (textBox3.Text.Length >= textSize)
                {
                    this.textBox4.Focus();
                }
            }        void textBox2_TextChanged(object sender, EventArgs e)
            {            if (textBox2.Text.Length >= textSize)
                {
                    this.textBox3.Focus();
                }
            }        void textBox1_TextChanged(object sender, EventArgs e)
            {
                if (textBox1.Text.Length >= textSize)
                {
                    this.textBox2.Focus();
                }
            }
        }
    }