problems between two forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vitorjol

    problems between two forms

    Hello.

    I have two forms: Form1 and Form2

    in Form1 i have a Subroutine like:

    Sub test(Byval valin as String)
    ......
    End Sub

    in form1 i call the form2, then in form2 after some calculations, i want to
    activate the form1 and send there a value to be calculate in sub Test.
    how can i do this?

    Thanks
  • Kevin Spencer

    #2
    Re: problems between two forms

    Create a property or field in the second class, which is of the type of the
    first class. Assign that property when the first class launches an instance
    of the second.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Software Composer

    A watched clock never boils.

    "vitorjol" <vitorjol@discu ssions.microsof t.comwrote in message
    news:F5AEDEB0-28BF-4054-B23F-D299B2C1C0A8@mi crosoft.com...
    Hello.
    >
    I have two forms: Form1 and Form2
    >
    in Form1 i have a Subroutine like:
    >
    Sub test(Byval valin as String)
    .....
    End Sub
    >
    in form1 i call the form2, then in form2 after some calculations, i want
    to
    activate the form1 and send there a value to be calculate in sub Test.
    how can i do this?
    >
    Thanks

    Comment

    • vitorjol

      #3
      Re: problems between two forms


      can u give me an example?

      "Kevin Spencer" wrote:
      Create a property or field in the second class, which is of the type of the
      first class. Assign that property when the first class launches an instance
      of the second.
      >
      --
      HTH,
      >
      Kevin Spencer
      Microsoft MVP
      Software Composer
      >
      A watched clock never boils.
      >
      "vitorjol" <vitorjol@discu ssions.microsof t.comwrote in message
      news:F5AEDEB0-28BF-4054-B23F-D299B2C1C0A8@mi crosoft.com...
      Hello.

      I have two forms: Form1 and Form2

      in Form1 i have a Subroutine like:

      Sub test(Byval valin as String)
      .....
      End Sub

      in form1 i call the form2, then in form2 after some calculations, i want
      to
      activate the form1 and send there a value to be calculate in sub Test.
      how can i do this?

      Thanks
      >
      >
      >

      Comment

      • Kevin Spencer

        #4
        Re: problems between two forms

        Code in Form1 (Host Form)
        *************** ******

        private Form2 _Form2;

        private void LaunchForm2()
        {
        _Form2 = new Form2();
        //...
        _Form2.Form1 = this;
        }

        Code in Form2
        *************** ******
        internal Form1 Form1;


        --
        HTH,

        Kevin Spencer
        Microsoft MVP
        Software Composer

        A watched clock never boils.


        "vitorjol" <vitorjol@discu ssions.microsof t.comwrote in message
        news:3D881688-6038-457F-AEB0-E19C3E5D1D16@mi crosoft.com...
        >
        can u give me an example?
        >
        "Kevin Spencer" wrote:
        >
        >Create a property or field in the second class, which is of the type of
        >the
        >first class. Assign that property when the first class launches an
        >instance
        >of the second.
        >>
        >--
        >HTH,
        >>
        >Kevin Spencer
        >Microsoft MVP
        >Software Composer
        >>
        >A watched clock never boils.
        >>
        >"vitorjol" <vitorjol@discu ssions.microsof t.comwrote in message
        >news:F5AEDEB 0-28BF-4054-B23F-D299B2C1C0A8@mi crosoft.com...
        Hello.
        >
        I have two forms: Form1 and Form2
        >
        in Form1 i have a Subroutine like:
        >
        Sub test(Byval valin as String)
        .....
        End Sub
        >
        in form1 i call the form2, then in form2 after some calculations, i
        want
        to
        activate the form1 and send there a value to be calculate in sub Test.
        how can i do this?
        >
        Thanks
        >>
        >>
        >>

        Comment

        • vitorjol

          #5
          Re: problems between two forms

          Thanks. Can u give me the code in VB .Net ?

          "Kevin Spencer" wrote:
          Code in Form1 (Host Form)
          *************** ******
          >
          private Form2 _Form2;
          >
          private void LaunchForm2()
          {
          _Form2 = new Form2();
          //...
          _Form2.Form1 = this;
          }
          >
          Code in Form2
          *************** ******
          internal Form1 Form1;
          >
          >
          --
          HTH,
          >
          Kevin Spencer
          Microsoft MVP
          Software Composer
          >
          A watched clock never boils.
          >
          >
          "vitorjol" <vitorjol@discu ssions.microsof t.comwrote in message
          news:3D881688-6038-457F-AEB0-E19C3E5D1D16@mi crosoft.com...

          can u give me an example?

          "Kevin Spencer" wrote:
          Create a property or field in the second class, which is of the type of
          the
          first class. Assign that property when the first class launches an
          instance
          of the second.
          >
          --
          HTH,
          >
          Kevin Spencer
          Microsoft MVP
          Software Composer
          >
          A watched clock never boils.
          >
          "vitorjol" <vitorjol@discu ssions.microsof t.comwrote in message
          news:F5AEDEB0-28BF-4054-B23F-D299B2C1C0A8@mi crosoft.com...
          Hello.

          I have two forms: Form1 and Form2

          in Form1 i have a Subroutine like:

          Sub test(Byval valin as String)
          .....
          End Sub

          in form1 i call the form2, then in form2 after some calculations, i
          want
          to
          activate the form1 and send there a value to be calculate in sub Test.
          how can i do this?

          Thanks
          >
          >
          >
          >
          >
          >

          Comment

          Working...