Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 C# N00B question

Author  Topic 

norty911
Starting Member

41 Posts

Posted - 2007-05-21 : 02:40:22
Hey guys,
How would you go abouts declaring a public array in form A and access that array in form B?

Muchos gracias in advance!

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-21 : 03:55:48
either make it static or just do
public List<string> _myStringArray;
in the first form
and in the second form do:
Form1 f = new Form1()
f._myStringArray = ...;



_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-05-21 : 08:21:27
As a general rule of thumb, if two forms need to share something, it shouldn't be part of either form's class definition -- it should be in a separate class or separate control that you put on both forms.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -