[RESOLVED] Interchangeable textboxes
I basically want to know if there is a way to make it so that if I write something in "text1" then it will also put that into "text12" and vice versa
I was trying to do this with a timer set to 15ms and this was my code
[code]
Private Sub Timer1_Timer()
Text1.Text = Text12.Text
End Sub[code]
That codes puts what I put in textbox12 also into textbox1, which is what I want, BUT when I try and put something in textbox1, it erases it.. So... Help?
Re: [HELP] Interchangeable textboxes
You could try using the KeyPress events and remove the need for a timer
Code:
Option Explicit
Private Sub Form_Load()
Text1.Text = ""
Text12.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text12.Text = Text12.Text & Chr(KeyAscii)
End Sub
Private Sub Text12_KeyPress(KeyAscii As Integer)
Text1.Text = Text1.Text & Chr(KeyAscii)
End Sub
Re: [HELP] Interchangeable textboxes
Quote:
Originally Posted by
Doogle
You could try using the KeyPress events and remove the need for a timer
Code:
Option Explicit
Private Sub Form_Load()
Text1.Text = ""
Text12.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text12.Text = Text12.Text & Chr(KeyAscii)
End Sub
Private Sub Text12_KeyPress(KeyAscii As Integer)
Text1.Text = Text1.Text & Chr(KeyAscii)
End Sub
Thank you so much =D
Re: [RESOLVED] Interchangeable textboxes
One thing to note, the solution above will not work if the user copies and pastes some data into one of the textboxes. You may need to play with the 'KeyPress' and 'Change' events if you want to support copy and paste.