Answer the question
In order to leave comments, you need to log in
How to reference an object in C#?
While learning C#, I ran into a problem unknown to me before, the question is probably funny and elementary, but it baffles me, on page 47 of Google I still gave up searching.
There is a class MainForm which has a public method public void goToDir(string path) {....};
There is another class in a separate Progress file, when I try to call the method by - MainForm.GoToDirectory(dest), I get that "For a non-static field, method or property "WApplication.MainForm.GoToDirectory(string)"
What should I do?
Answer the question
In order to leave comments, you need to log in
Pass and store a reference to the MainForm object in the Progress class, or make the GoToDirectory method static.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question