Results 1 to 3 of 3

Thread: Forms and Textboxs

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    138

    Forms and Textboxs

    I have two forms in my project, Form1 and Form2

    In Form1 there is one TextBox called Text1, and in the Form2 there is TextBox called Text2. I have one button in Form1, called Button1. When I click on Button1 I want that Form2 open and in Text2 is text from Text1.

    Code for Button1:

    Me.Hide
    Form2.Show

    Form2_Shown:
    Text2.Text = Form1.Text1.Text

    And Form2 open but in Text2 there is no text. What's the problem?

  2. #2
    Lively Member
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    115

    Re: Forms and Textboxs

    Hi

    Firstly can you check that the two textboxes are indeed named as you said in your post. I have run a trial using default textbox names with the code you gave for your button and the test ran OK.

    If the textbox names are correct , try moving the following line of code into the form_load event.
    Code:
    Text2.Text = Form1.Text1.Text
    Regards
    Colin

    If my comments helped please remember to add to my reputation using Rate This Post.

    If your problem has been resolved please mark the thread resolved using the "Mark Thread Resolved" link in thread tools.

    CodeBank Submissions: 1) WebBrowser - Delete cookies etc 2) Import My.Settings from previous build version

  3. #3
    Lively Member
    Join Date
    Apr 2010
    Location
    Australia
    Posts
    71

    Re: Forms and Textboxs

    ^Second that. Works for me in form load of form2.

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