I would like to know how to communicate between forms using C#?
In Visual Basic it was easier since each form had it's own instance, with C# it's different.
In the Program
Class I setup a public and static variable that hold my form:
public static FormProcess2 frmProcess2 = null;
Then in the Main
method I create the form and show it up:
frmProcess2 = new FormProcess2();
frmProcess2.ShowDialog();
Now when that form loads, it load a background process that process XML files.
And the method that process all the files are in another class name XMLParser
.
So in the BackgroundWorker
doWork
I load that method by:
XMLParser.Start();
Now the question is, how I can modify the frmProcess2
controls in the XMLParser
class?
I wanted it to show what's being updated by changing the label text as well as put some nice progress bar there.
But I can't access the Program.frmProcess2
controls, all I can access is it's defaults only...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…