Let's say I have this code:
And then in MyOtherClass...Code:using this; using that; namespace myNamespace { public partial class Form1 : Form { public string myString; public Form1() { InitializeComponent(); } private void SetButton_Click(object sender, EventArgs e) { MyOtherClass.TryToAccessMyString() } } }
Isn't there a way to access myString without passing it as an argument? It's been ten+ years since I have taken a programming class, so I am a little rusty. Please go easy on me. What is this concept called that I am trying to do (or break?) I'd be happy to just read up on it but I don't even know what to look up.Code:public class MyOtherClass { internal static void TryToAccessMyString() { string testString = myNamespace.Form1.myString; //doesn't work } }
Thanks in advance.
Skip




Reply With Quote