954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

multiple forms

i have two forms in my program. The second form appears when button1 is clicked. I would like the information (textboxes) to be filled in when the second form loads. basically i have a complex calculator and when button 1 is clicked i want a second form to show with multiple answers populated into textboxes. any ideas?

ng5
Light Poster
41 posts since Dec 2011
Reputation Points: 19
Solved Threads: 0
 
Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        With Form2
            .TextBox1.Text = TextBox1.Text
            .Show()
        End With
    End Sub
End Class
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

You can also do:

Public Class Form1
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Form2.Show()
        Form2.TextBox1.Text = Me.TextBox1.Text 'Where Me references Form1 - the TextBox1 from Form1
    End Sub
End Class
Begginnerdev
Posting Pro in Training
405 posts since Apr 2010
Reputation Points: 69
Solved Threads: 59
 

thank you

ng5
Light Poster
41 posts since Dec 2011
Reputation Points: 19
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: