Private Sub Command1_Click() '取左5个
Text2.Text = Left(Text1.Text, 5)
End Sub
Private Sub Command3_Click() ''总个数
Text3.Text = Len(Text1.Text)
End Sub
Private Sub Text1_LostFocus()'输入要大于5以上
If Len(Text1.Text) <= 5 Then A = MsgBox("输入5个字以上", vbOK, "提示")
End Sub
窗体设计你自己设计一下吧,一个textbox
和一个button,窗口设计器代码是:
Private
Sub
Button1_Click(ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
Button1.Click
Dim
a
As
String
Dim
b
As
String
a
=
Mid(TextBox1.Text,
1,
TextBox1.SelectionStart)
b=
Mid(TextBox1.Text,
TextBox1.SelectionStart
+
TextBox1.SelectionLength
+
1)
TextBox1.Text
=
sl
+
sr
End
Sub
我试过的,可以实现!
简单
Private Sub Command1_Click()
Text2.Text = Left(Text.Text, 5)
End Sub
Private Sub Command2_Click()
Text3.Text = Len(Text.Text)
End Sub