I have the method listviewupdate() in usercontrol schuler. Usercontrol schuler is in form1. Then I have form2. When I click a button in form2 I want to call the method listviewupdate().
I tried creating a second method in form1 which calls the listviewupdate() method, and then calling this second method in form 2 but I get an error. Can somebody please help me?
In your file
Program.cs, you can define a globally accessible variable:The static variable
MainFormcan then be used to access any public method toForm1viaProgram.MainForm.MyMethod().Assuming, you have access to the
Form2object from withinForm1, you can use theForm2object variable to callForm2methods out ofForm1methods.Be aware that you might run into problems when (unknowingly ...) using more than one thread. Read about BeginInvoke.