erikm007

Hey

I've searched and searched but I haven't found a solution to this problem...

All I want to do is pass a string from one form to another. And since C# doesn't allow global variables (or does it... ), I haven't found a way to do this. Let me know if you need more information to solve this problem.

Thanks



Re: Visual C# Express Edition Pass a variable from one form to another...

ahmedilyas

C# does allow global variables but only for that class instance...to pass objects around take a look at this:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=729974&SiteID=1






Re: Visual C# Express Edition Pass a variable from one form to another...

FreshHorses

I tried the code that was suggested at this link but C# doesn't recognize "private" at the location where it states it should be.





Re: Visual C# Express Edition Pass a variable from one form to another...

paoloTheCool

To do this, I use a Settings variable. It is very easy to do. Create a string setting "MyString" and when you need to send that data from one form to another, on the form that has a string that you need to send, do something like

Properties.Settings.Default.MyString = thestringthatneedstobesaved;

Thanks,

paoloTheCool