By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,238 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,238 IT Pros & Developers. It's quick & easy.

Get value from another class.

P: n/a
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.
Nov 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
* "sam" <an*******@discussions.microsoft.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
sam
Thanks.
Can you give me the simplest code?
I really did not know how to implement your idea.
Thanks again.
-----Original Message-----
* "sam" <an*******@discussions.microsoft.com> scripsit:
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 classesbetween them. Then you can access the other class' property.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
.

Nov 20 '05 #3

P: n/a
Cor
Hi Sam,

As a dialogform2
\\\
dim frm as new form2
frm.mypublic = "Sam"
frm.showdialog
mypublicInform1 = frm.mypubic
frm.dispose
///
I have two classes.
I want to pass value from Form1.vb to Form2.vb.
And then return the calculated value from Form2.vb.

Nov 20 '05 #4

P: n/a
sam
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.
-----Original Message-----
Hi Sam,

As a dialogform2
\\\
dim frm as new form2
frm.mypublic = "Sam"
frm.showdialog
mypublicInform1 = frm.mypubic
frm.dispose
///
I have two classes.
I want to pass value from Form1.vb to Form2.vb.
And then return the calculated value from Form2.vb.

.

Nov 20 '05 #5

P: n/a
"sam" <an*******@discussions.microsoft.com> schrieb
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
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6

P: n/a
sam
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.
-----Original Message-----
Hi Sam,

As a dialogform2
\\\
dim frm as new form2
frm.mypublic = "Sam"
frm.showdialog
mypublicInform1 = frm.mypubic
frm.dispose
///
I have two classes.
I want to pass value from Form1.vb to Form2.vb.
And then return the calculated value from Form2.vb.

.

Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.