From Form To Form Program

This program shows the transport of data from one form to the other.

To get the program going, you need: Two forms F1 and F2. On F1 you need 2 textboxes and 1 commandbutton. On F2 you need 2 textboxes and 4 commandbuttons.

How does this look ? See it here F1 ( in German )

How does this look ? See it here F2

The code for F1:

    ' F1.class

    STATIC PUBLIC SUB Main()
      DIM hForm AS Form
      hForm = NEW F1
      hForm.show
    END

    PRIVATE hNew AS F2

    PUBLIC SUB Button1_Click()
        hNew = NEW F2(textbox1.text)
        hNew.Show
        ME.hide
    END

    PUBLIC SUB _new(OPTIONAL t$ AS String)
      Textbox2.Text=t$
    END

The code for F2:

    ' F2.class:

    'Here the data arrive from F1
    'the parameter has TO be OPTIONAL,
    'otherwise it would be impossible to
    'initialize an instance of this class
    'without a parameter
    PUBLIC SUB _new(OPTIONAL t$ AS String)
        Textbox1.Text=t$
    END

    'Here some data are added to the text of F1
    PUBLIC SUB Button1_Click()
    textbox2.text = Textbox1.Text & "Miller !"
    END

    PUBLIC SUB Button3_Click()
    textbox2.text = Textbox1.Text & "Smith !"
    END

    PUBLIC SUB Button4_Click()
    textbox2.text = Textbox1.Text & "Mayr !"
    END

    'Here it goes back to F1
    PRIVATE hNew AS F1

    PUBLIC SUB Button2_Click()
        hNew = NEW F1(textbox2.text)
        hNew.Show
        ME.Close
    END

-- ReinerHoffmann - 12 Feb 2004