Results 1 to 3 of 3

Thread: Text and Different Forms

  1. #1

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Lightbulb Text and Different Forms

    I have a text box (textbox1) on Form2. I would like the text in textbox1 to display in label1 on Form3, but in VB.net i have no idea how to make it to that. In VB6 all i had to do in Form3 is type:

    Private Sub Form_Load()
    Label1.Caption = Form2.TextBox1.Text
    End Sub

    How can I do that in VB.net?

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Try this in form2

    VB Code:
    1. Dim frm3 as new form3
    2.  
    3. Private Sub Form_Load()
    4. Form3.TextBox1.Text =Label1.Text
    5. End Sub

  3. #3
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    I think that would look for Label1 on the same form though. You might be able to do something with MDI, where the parent actually sets the values. Or - if you have a class that invokes all of these forms, you can have this class do the work - as it hosts the form objects and has access to their control collections.

    In theory at least.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width