|
-
Oct 14th, 2005, 10:39 PM
#1
Thread Starter
Fanatic Member
Texbox to Textbox?
This must be a stupid question, but after an hour of trying it's now intelligent for me to ask.
How would I sync a form's textbox, with the main form's textbox?
When the user, click a button on the main form, another form loads up.
Then when they change the textbox, I want a textbox in the main form to be updated with that string. Simple right!
In the old VB6, this was completely trivial.
It seems that .NET is not as easy, perhaps for protection?
I tried delclaring the form, and texbox, but to no avail.
At a loss,
TT(n)
-
Oct 14th, 2005, 11:14 PM
#2
Frenzied Member
Re: Texbox to Textbox?
Does the main form get updated when the user clicks a button to close it? It should be easy to do that.
This is the code on the main form
VB Code:
Private Sub Button1_Click(sender as System.Object, e as System.Eventargs) Handles Button1.Click
Dim NewFrm as New Form2
NewFrm.TextBox1.Text = TextBox1.Text
If NewFrm.Show = DialogResult.Ok Then
TextBox1.Text = NewFrm.TextBox1.Text
End If
End Sub
-
Oct 14th, 2005, 11:27 PM
#3
Thread Starter
Fanatic Member
Re: Texbox to Textbox?
Thanks, but no, when it get's changed. I thought I was clear on that
Your example didn't seem to work either.
This is the event I want to update the main form with.
This event is in the form, that was loaded by the main form.
VB Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
'how to update the main form's TexBox2.text, with the contents of TextBox1.text
End Sub
-
Oct 15th, 2005, 12:00 AM
#4
Fanatic Member
Re: Texbox to Textbox?
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fr As New Form1
AddHandler fr.TextBox1.TextChanged, AddressOf ChangeHandler
fr.Show()
End Sub
Private Sub ChangeHandler(ByVal sender As Object, ByVal e As EventArgs)
Me.TextBox1.Text = DirectCast(sender, TextBox).Text
End Sub
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Oct 15th, 2005, 12:20 AM
#5
Thread Starter
Fanatic Member
Re: Texbox to Textbox?
Thank a centillion!
RESOLVED
I've rated your post!
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
|