problems between two forms

G

Guest

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
 
K

Kevin Spencer

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.
 
G

Guest

can u give me an example?

Kevin Spencer said:
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.
 
K

Kevin Spencer

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.
 
G

Guest

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

Kevin Spencer said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top