如何将combox的内容添加到textbox光标的当前位置?
有textbox和combox两个控件,想通过选择combox将内容添加到textbox光标的当前位置,应该怎么实现?我发现一点击combox时,textbox就失去了焦点(光标),实现不了,有高手指点下,谢谢!
[解决办法]
dim Tb_SelStart as integer '在textbox编辑时保存该值为插入点
[解决办法]
TextBox1.SelectionStart = TextBox1.Text.Length '使光标在最后
TextBox1.Select()
[解决办法]
Dim p As Integer Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus p = TextBox1.SelectionStart End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = TextBox1.Text.Insert(p, "就是这样用") End Sub