0

I know its a silly question but I still want to know it. I have two textboxes, textbox1 and textbox2. I entered some text in textbox1. Now I want that the first 3 characters of textbox1 first to be displayed in textbox2 when I move from textbox1 to textbox2 using tab index or by clicking my mouse on textbox2. I know I can make us of the mouse over event, but it will be great if I get some good opinions from you. Thanks in advance.

Thomas Fenzl
  • 4,342
  • 1
  • 17
  • 25
vijay
  • 1
  • 1

1 Answers1

0

This should do the job :

Private Sub textbox2_GotFocus()
 Dim length As Integer
 length = Len(textbox1.Text)
 If length > 3 Then length = 3
 textbox2.Text = Left$(textbox1.Text, length)
End Sub

The GotFocus event will trigger if you click on the textbox or if you use tab key.

d-stroyer
  • 2,638
  • 2
  • 19
  • 31