473,396 Members | 1,766 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,396 software developers and data experts.

How to achieve Global scope of arraylists

ree
I am new to c#

Since you cant use vectors in it.
I was trying to use an arraylist, but the problem is how do I get an
arraylist to have a global scope. I.e. accessing the arraylist of objects
in different dialog boxes.

Thanks
Nov 16 '05 #1
3 1493
Hi,
Keep the array list in a seperate class, and make the array list public
static. Then you can access it like this
MySeperateClass.MyArrayList = new System.Collections.ArrayList();
MySeperateClass.MyArrayList.Add("Hello");
Console.WriteLine(MySeperateClass.MyArrayList[0]);

public class MySeperateClass
{
public static System.Collections.ArrayList MyArrayList;
}
-benny

ree wrote:
I am new to c#

Since you cant use vectors in it.
I was trying to use an arraylist, but the problem is how do I get an
arraylist to have a global scope. I.e. accessing the arraylist of objects
in different dialog boxes.

Thanks


Nov 16 '05 #2
ree
Benny Mathew <be************@yahoo.com> wrote in news:eH96DJkOEHA.680
@TK2MSFTNGP11.phx.gbl:
System.Collections.ArrayList


Thanks
Nov 16 '05 #3
You could also just make the arraylist public in your form or make a public
property to the private var without needing another class.

--
William Stacey, MVP

"ree" <re*@hotmail.coom> wrote in message
news:Xn****************************@211.29.133.50. ..
I am new to c#

Since you cant use vectors in it.
I was trying to use an arraylist, but the problem is how do I get an
arraylist to have a global scope. I.e. accessing the arraylist of objects
in different dialog boxes.

Thanks


Nov 16 '05 #4

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

Similar topics

8
by: lawrence | last post by:
I'm learning Javascript. I downloaded a script for study. Please tell me how the variable "loop" can have scope in the first function when it is altered in the second function? It is not defined...
5
by: j | last post by:
Anyone here feel that "global variables" is misleading for variables whose scope is file scope? "global" seems to imply global visibility, while this isn't true for variables whose scope is file...
2
by: Estella | last post by:
Hello, I wrote a function called eat_path() to split a string into components e.g. /a/b/c ==> namePtr = a,namePtr = a, namePtr = c // Global variable char *namePtr = {0}; int n; /*number of...
5
by: george r smith | last post by:
In the MSDN documentation there is a reference to "the global scope". For example "You can declare types directly in the global scope." I have search extensively and can not find a definition of...
9
by: CDMAPoster | last post by:
About a year ago there was a thread about the use of global variables in A97: http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157 Best Practices by Kang...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
11
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
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...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.