textBox中已经有一些字符,光标停在这些字符中间,我想按“UP”键时,编辑框中的光标跑到最右边。我试过
          textBox1.SelectionStart = textBox1.TextLength;
          textBox1.SelectionLength = 0;
可是光标停在倒数第一个字符之前。请各位高手帮忙。问题解决立即散分。

解决方案 »

  1.   

    private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
    {
    if(e.KeyValue == 38)
    {
    textBox1.SelectionStart = textBox1.TextLength;
    textBox1.SelectionLength = 0;
    }
    }我是这么写的
      

  2.   

    this.textBox1.SelectionStart = this.textBox1.SelectedText.Length;
      

  3.   


    if(e.KeyValue == 38)
    {
                                         textBox1.Focus();
    textBox1.SelectionStart = textBox1.TextLength;
    textBox1.SelectionLength = 0;
    }
      

  4.   

    多谢各位兄台利用节假日帮助小弟,小弟万分感激。
    To:  honglin119
         您的方法也是将插入焦点定位在倒数第一个字符之前。
    To:   twidtfdatao
         您的方法把插入焦点放在了最左边。我想实现的是放在最右边还望各位帮忙了。