.net - how to change button text using static function? -


I need to change a button text by using the static task.

  Fixed string [ARRay = new string [10]; [STAThread] static zero main () {string [] args = Environment.GetCommandLineArgs (); For (int i = 1; i! = Args.Length; ++ i) {command (i.ToString ()); ARRay [0] = Eye. Toasting (); } Applications. Enabledview style (); Application.SetCompatibleTextRenderingDefault (wrong); Application.Run (New Form 1 ()); } Fixed zero order (string line) {button1.Text = ARRay [0]; // here error}  

First of all, button1 It looks like members of

form form 1 You must first store Form1 in the main method by declaring a stable member:

  stable Form1 myForm;  

and then run method application :

  myForm = new form 1 ( ); Application.Run (MyForm);  

After doing so, you have two options: 1. If the button1 is a public button < / Code>, you can use this line in your order method:

  myForm.button1.Text = ARRay [0];  

or 2. You declared public method to update Form1 class to update Can button 1. Text .


Comments