或者这样Private Sub Command1_Click() Text1.SetFocus Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) End Sub
用数组好办 Private Sub Text1_GotFocus(Index As Integer) Text1(Index).SelStart = 0 Text1(Index).SelLength = Len(Text1(Index).Text) End Sub
Private Sub Command1_Click() Text1.Text = "test" Text1.SelStart = 0 if len(Len(Text1.Text))>0 then Text1.SelLength = Len(Text1.Text) text1.setfouse '使text1得到焦点 End Sub
Text1.SelLength = Len(Text1.Text)
我建个text框和一个command按钮。代码如下:
Private Sub Command1_Click()
Text1.Text = "test"
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub不好用啊,文字没有被选种啊?请高手解答
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).SelStart = 0
Text1(Index).SelLength = Len(Text1(Index).Text)
End Sub
Text1.Text = "test"
Text1.SelStart = 0
if len(Len(Text1.Text))>0 then Text1.SelLength = Len(Text1.Text)
text1.setfouse '使text1得到焦点
End Sub
Text1.SelStart = 1
Text1.SelLength = Len(Text1.Text)