Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 7th, 2006, 6:21 AM   #1
nez
Programmer
 
nez's Avatar
 
Join Date: May 2005
Location: Plymouth UK
Posts: 34
Rep Power: 0 nez is on a distinguished road
Send a message via MSN to nez
Red face Variables between forms

Hi all

I've got kinda stuck with my C# program.
I'm trying to transfer a variable (lets say and int) from one windows form to another, both in the same program, almost like a dialog, but i want to be able to transfer variables between both forms.

I know it can be done, i see it in so many programs that i use every day, but i cant pinpoint exactly what it is, its been bugging me for a week or so and i cant really do much more until i get this fixed.

Any help or clues to send me in the right direction would be much appreciated.

I'm using Visual C# 2005 and the .net 2.0 framework

Thanks very much
Nez
__________________
atariboy.wordpress.com
nez is offline   Reply With Quote
Old Mar 7th, 2006, 6:41 AM   #2
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
You can make use of properties, you can also make them protected or public, the latter is discouraged, because global variables can confuse you, and in turn will confuse your compiler or program if you misuse them.

BTW: Your link in your signature is leads to http://atariboy.wordpress.com/%3Cbr%20/%3EBlog.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 7th, 2006, 6:45 AM   #3
nez
Programmer
 
nez's Avatar
 
Join Date: May 2005
Location: Plymouth UK
Posts: 34
Rep Power: 0 nez is on a distinguished road
Send a message via MSN to nez
So it does, thanks nnxion, at least you've given me some things to look into, cheers
updated my sig too
__________________
atariboy.wordpress.com
nez is offline   Reply With Quote
Old Mar 7th, 2006, 6:55 AM   #4
nez
Programmer
 
nez's Avatar
 
Join Date: May 2005
Location: Plymouth UK
Posts: 34
Rep Power: 0 nez is on a distinguished road
Send a message via MSN to nez
I'm looking in and around static/instance variables, is that the right kind of area?

Although like you said nnxion, i'm seeing a lot of warnings about static variables and how i should not really use them

or maybe MDI is the way to go?
__________________
atariboy.wordpress.com

Last edited by nez; Mar 7th, 2006 at 7:19 AM.
nez is offline   Reply With Quote
Old Mar 7th, 2006, 2:24 PM   #5
nez
Programmer
 
nez's Avatar
 
Join Date: May 2005
Location: Plymouth UK
Posts: 34
Rep Power: 0 nez is on a distinguished road
Send a message via MSN to nez
Any ideas anyone? this is doing my head in, i know its possible, and i think im close, but i'm just not sure exactly how, and i dont want to use MDI either.

Any help would be good, thanks

Nez

Edit: Got it now, thanks nnxion
__________________
atariboy.wordpress.com

Last edited by nez; Mar 7th, 2006 at 2:48 PM.
nez is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:56 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC