473,507 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get value from another class.

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
6 1371
* "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
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
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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2177
by: Edward Diener | last post by:
This has occurred in MC++, but since there is very little response on that NG, I am also reporting it here in the hope that someone can find me a workaround, and report it to MS. If a __value...
3
1405
by: JKop | last post by:
Consider the following platform: char = 8-bit short = 16-bit int = 32-bit long = 32-bit
5
1540
by: Javier Campos | last post by:
WARNING: This is an HTML post, for the sake of readability, if your client can see HTML posts, do it, it doesn't contain any script or virus :-) I can reformat a non-HTML post if you want me to (and...
6
1245
by: Raterus | last post by:
Hello, Does anyone have any ideas how I can accomplish this using properties. I'm trying to create a property, that acts like a structure. Basically I'm trying to create a property that I could...
19
2620
by: Dennis | last post by:
I have a public variable in a class of type color declared as follows: public mycolor as color = color.Empty I want to check to see if the user has specified a color like; if mycolor =...
2
1589
by: Rudy | last post by:
Hello All! I have been trying to figure this out, have recieved alot of help, but it's just not clicking in the ol' noggin. I basicly have a value in a text box, I need to keep that value and...
4
3130
by: Mike | last post by:
Class A public objX I want to create 2 or more instances of Class A and have the same value for objX in all instances. Instance1 of Class A Instance2 of Class A Instance3 of Class A
0
2019
by: zman77 | last post by:
EDIT: -- forgot to mention... I am using Visual Studio 2005, on Win XP, on an intel machine Hi. This is my first post, though I've "lurked" for a while because I find these forums very helpful....
1
4068
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
275
12036
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7029
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7481
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.