Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21237

[RESOLVED] Textbox Question: Why does this only work one time

$
0
0
I have a textbox which I load with a single line of text in Form_Load() and also I have Text1_GotFocus event like this:

Code:

Private Sub Text1_GotFocus()
 '
 ' appears to only run on Form load
 '
 Text1.SelStart = Len(Text1.Text)
End Sub

When the app loads up you see the single line of text in the textbox and the cursor immediately follows the last character in the text line on the same line. This is because of the GotFocus event

Now if I type something it will enter the characters on that same line and when I click the Enter key I do the following:

Text1.SelStart = Len(Text1.Text)

just like it did in GotFocus event but the cursor does not follow the last character but rather goes to the next line.

Why does it put the cursor on the same line the first time but wont do it any other time?

Viewing all articles
Browse latest Browse all 21237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>