我正在尝试弄清楚如何将字符串“End”插入到特定光标点的文本框中?(“???”在下面的代码中)
正如您在下面的代码中看到的那样,当用户在文本框中的键盘上单击返回时,就会发生这种情况。
我有代码来获取存储为整数“intcurrentcolumn”的游标索引。
谢谢
Private Sub Enter_Click(ByVal Sender As System.Object, ByVal k As System.Windows.Forms.KeyEventArgs)
Dim MyTextBox As TextBox = sender
Dim intindex As Integer
Dim intcurrentcolumn As Integer
Dim NewString As String
If k.KeyCode = Keys.Return Then
k.SuppressKeyPress = True
intindex = MyTextBox.SelectionStart
intcurrentColumn = intindex - MyTextBox.GetFirstCharIndexFromLine(intcurrentLine)
If intindex = MyTextBox.Text.Length Then
NewString = MyTextBox.Text & "<End>"
Else:
???
End If
MyTextBox.Text = NewString
'Sets cursor to end of textbox
MyTextBox.Select(MyTextBox.Text.Length, 0)
End If
提前致谢 !