473,382 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Global Data

Hi,

I am desiging a windows form application that that will have a hierarchy of
forms.

Can anyone tell me the best way of passing data between these forms?

Is it possible to use global variables or some sort of messaging like in
Visual C++?

Thanks In Advance
Macca

Nov 17 '05 #1
1 1904

Form1 code:

Form2 my2ndForm = new Form2()
my2ndForm.Property1 = "some value";
my2ndForm.Property2 = "some other value";
DialogResult result = my2ndForm.ShowDialog();

// result now contains a return code from the dialog

Form2 code:

string _property1 = "";
public string Property1
{
set
{
_property1 = value;
}
get
{
return _property1;
}
}

//
// complete as property 2 as with property1

// you can now reference _property1 and _property2
// in your form code, for form initialization place
// in the load event handler for the form
hope that helps

Dan.
Macca wrote:
Hi,

I am desiging a windows form application that that will have a hierarchy of
forms.

Can anyone tell me the best way of passing data between these forms?

Is it possible to use global variables or some sort of messaging like in
Visual C++?

Thanks In Advance
Macca

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
33
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have...
6
by: MechSoft | last post by:
Hi, I am new to C++ from C, I am a bit confused about using global objects in C++. I have a program that need to share some data(held in classes) between files, and of course I thought about using...
5
by: WJ | last post by:
I am attempting to use the Global.Asax to store my user's configuration. Here is the concept: 1. User logs on into the site using Form Authentication. 2. I capture the user Credential, verify it...
41
by: Miguel Dias Moura | last post by:
Hello, I am working on an ASP.NET / VB page and I created a variable "query": Sub Page_Load(sender As Object, e As System.EventArgs) Dim query as String = String.Empty ... query =...
15
by: randyr | last post by:
I am developing an asp.net app based on a previous asp application. in the asp applications global.asa file I had several <object id="id" runat="server" scope="scope" class="comclass"> tags for...
4
by: wakun | last post by:
Hi there, I have been using C for years. For some project I've done times ago, I always need to share variable between modules. The structure of my project is illustrated as follow /* global.h...
23
by: David Colliver | last post by:
Hi, using c#, 1.1 I know that we are not supposed to use global variables etc. in c# I am having a problem, but not sure how to resolve. I did have another post here, but may have over...
5
by: Sandman | last post by:
I dont think I understand them. I've read the section on scope in the manual inside out. I'm running PHP 5.2.0 Here is the code I'm working on: //include_me.php <?php $MYVAR = array(); global...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.