Get value from another class.

  • Thread starter Thread starter sam
  • Start date Start date
S

sam

I have two classes.
I want to pass value from Form1.vb to Form2.vb.
And then return the calculated value from Form2.vb.

Can you teache me how to do this? Thanks in advance.
 
* "sam said:
I have two classes.
I want to pass value from Form1.vb to Form2.vb.
And then return the calculated value from Form2.vb.

Add public properties to the classes and pass references to the classes
between them. Then you can access the other class' property.
 
Thanks.
Can you give me the simplest code?
I really did not know how to implement your idea.
Thanks again.
 
Hi Sam,

As a dialogform2
\\\
dim frm as new form2
frm.mypublic = "Sam"
frm.showdialog
mypublicInform1 = frm.mypubic
frm.dispose
///
 
sam said:
Thanks.
Can you give me the simplest code?
I really did not know how to implement your idea.

There are chapters and examples in the docs:

<F1>
VS.NET
VB and VC#
Reference
Visual Basic Language
Tour Through VB
Object Oriented Programming
 
Thanks for your sample code.
Do I need to add any code in order to use mypublic
function?
After I dim frm, frm cannot get its mypublic function.
It will have blue underline.
 
Thanks for your sample code.
Do I need to add any code in order to use mypublic
function?
After I dim frm, frm cannot get its mypublic function.
It will have blue underline.

What is mypublicInform1? And,How form1 can get value
returned
from form2? I mean what should I dim for variable in order
to capture
result values from form2.
Thanks in advance.
 
Back
Top