CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Not Shure

  1. #1
    Join Date
    Jan 2000
    Posts
    19

    Not Shure

    I have two forms Form1 and Form2 I need to know how to get info in text1 on form1 to go to text1 on form2 when command1 on form1 is clicked

    Thanks in Advance
    Donny S.


  2. #2
    Join Date
    Jan 2000
    Posts
    45

    Re: Not Shure

    command1_click()
    text1 = form2.text1
    end sub


  3. #3
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Not Shure

    Form2.Text1.Text = Form1.Text1.Text



  4. #4
    Join Date
    Jan 2000
    Posts
    19

    Re: Not Shure

    I can't get the code you gave me to work i must be doing something wrong is there more you can tell me or show me.

    Thanks in Advance
    Donny S.


  5. #5
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Not Shure

    Make 2 forms, on form1 add a texbox, and on form2 add a textbox. On form1 add a command button, double click the command button which will take you to the code window where you will see

    private Sub Command1_Click()

    End Sub



    add following line

    Form2.Text1.Text = Form1.Text1.Text



    so it will look like this
    private Sub Command1_Click()
    Form2.Text1.Text = Form1.Text1.Text
    End Sub



    now double click on Form1 and add this line inside this code

    private Sub Form_Load()

    End Sub



    add this lines between those above so it will look like this


    private Sub Form_Load()
    Text1.Text = "Hello"
    Form2.Show
    End Sub




    run the project and press command1, look onto form2's textbox, it should get the string "Hello" after command1 had been pressed

    Good Luck with your programming, you can read free book at www.informit.com, if you want to get started with VB



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

Featured