问题:
希望设置TextBox 中的光标到任意位置。

设置SelectStart 和Length 不一地起作用,并不希望选中文本。

解决方案:
使用一下代码就可以

C# tips- 设置文本框光标的位置[转]        [System.Runtime.InteropServices.DllImport("user32.dll")]
C# tips- 设置文本框光标的位置[转]        
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
C# tips- 设置文本框光标的位置[转] 
C# tips- 设置文本框光标的位置[转]        
public void SetCursorPosofTextBox(TextBox txb,int pos)

调用:

C# tips- 设置文本框光标的位置[转]SetCursorPosofTextBox(this.textBox1,3);        

相关文章: