Option ExplicitPrivate Sub Command1_Click() If Text1.SelStart > 0 Then Text1.Text = Mid(Text1.Text, 1, Text1.SelStart - 1) & Mid(Text1.Text, Text1.SelStart + 1) End If End Sub
Option ExplicitPrivate Sub Command1_Click() Dim BakIndex As Long BakIndex = Text1.SelStart If Text1.SelStart > 0 Then Text1.Text = Mid(Text1.Text, 1, Text1.SelStart - 1) & Mid(Text1.Text, Text1.SelStart + 1) Text1.SelStart = BakIndex - 1 Text1.SetFocus
End If End Sub
Private Sub Command1_Click() Text1.SetFocus SendKeys "{BACKSPACE}" End Sub
vstr = Text1.Text
lstr = Len(vstr)
Text1.Text = Left(vstr, lstr - 1)
End Sub
你把光标放在 3和5之间就不是试一下
Option ExplicitPrivate Sub Command1_Click()
If Text1.SelStart > 0 Then
Text1.Text = Mid(Text1.Text, 1, Text1.SelStart - 1) & Mid(Text1.Text, Text1.SelStart + 1)
End If
End Sub
Dim BakIndex As Long
BakIndex = Text1.SelStart
If Text1.SelStart > 0 Then
Text1.Text = Mid(Text1.Text, 1, Text1.SelStart - 1) & Mid(Text1.Text, Text1.SelStart + 1)
Text1.SelStart = BakIndex - 1
Text1.SetFocus
End If
End Sub
Private Sub Command1_Click()
Text1.SetFocus
SendKeys "{BACKSPACE}"
End Sub