Delphi Prism: How to access control(s) on a mainform from another form to update its properites?
I have looked at a very simila开发者_JAVA百科r stackoverflow question(s), but the answers aren't helping me.
Updating textbox on mainform with a variable on a child form that is launched from main form
Say I have a TLabel on the Mainform and I have winform A and B. Winform B is launched from winform A. How do you get access to the TLabel on mainform from winform B to update its (say) Text property?
Thanks in advance.
In Program.pas, create static main winform as follows:
Program = assembly static class
private
class method OnThreadException(sender: Object; e: ThreadExceptionEventArgs);
public
class var lMainForm:MainForm;
class method Main(args: array of string);
end;
In Main method do the following:
[STAThread]
class method Program.Main(args: array of string);
begin
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += OnThreadException;
lMainForm := new MainForm;
Application.Run(lMainForm);
end
精彩评论