|
-
Apr 12th, 2011, 11:41 PM
#1
Thread Starter
Junior Member
[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?
Last edited by Dgameman1; Apr 13th, 2011 at 01:11 AM.
-
Apr 13th, 2011, 12:46 AM
#2
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
-
Apr 13th, 2011, 01:11 AM
#3
Thread Starter
Junior Member
Re: [HELP] Interchangeable textboxes
 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
-
Apr 13th, 2011, 01:27 AM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|