同志们好! 如何使光标回车移动到下一个文本框内时,使光标全部选中文本框内原有的内容,而不是一小竖道?以便于修改数据! 请帮忙修改一下如下:谢谢! Sub Text1_KeyPress(KeyAscii As Integer) '将光标移动到下一个文本框 If KeyAscii = 13 Then SendKeys "{Tab}" KeyAscii = 0 End If End Sub
把下一文本框也加上就是了啊 Private Sub Text2_GotFocus() Text2.SelStart = 0 Text2.SelLength = Len(Text2.Text) End Sub Private Sub Text3_GotFocus() Text3.SelStart = 0 Text3.SelLength = Len(Text3.Text) End Sub
Sub Text1_KeyPress(KeyAscii As Integer) '将光标移动到下一个文本框 Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) If KeyAscii = 13 Then SendKeys "{Tab}" KeyAscii = 0 End If End Sub
晕,应该是单独地写 是单独的一个SUB 不要写在一起啊。 一定要写请写成这样: Sub Text1_KeyPress(KeyAscii As Integer) '将光标移动到下一个文本框 If KeyAscii = 13 Then SendKeys "{Tab}" KeyAscii = 0 End If Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) End Sub