Results 1 to 4 of 4

Thread: Linking text boxes on different forms.... why wont my code work?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Location
    Ma
    Posts
    19

    Linking text boxes on different forms.... why wont my code work?

    I cant figure out how to link two text boxes on different forms together.

    What I want to do is this:

    From Form one, click a menu button and have it open form2. On form 2, you select something and it sends a text value back to form 1.

    I cant figure it out.

    Somebody save me

  2. #2
    New Member
    Join Date
    May 2004
    Posts
    5
    Hi,

    it will work if you use global variable.

    I assume you did the following on form2:

    dim f as new form1

    f.textbox1.text=me.textbox1.text

    I also assume you want text box on form 1 to display the value after form 2 is closed


    So try this:

    in any module declare a variable, for example

    Global gMyText as string

    On form2 do this:

    gMyText=me.textbox1.text

    on form1 on activate event do this
    me.textbox1.text=gMyText

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    There are several recent threads on this. There are several ways to do what you want. Check the threads for the different advantages and disadvantages.

    The simplest way is to instantiate all the forms as public in a module.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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