Referance Problem
-
Hi! I need to activate a function after 5 seconds that the form is running, i created this void fnction in the general class of the project and now i am trying to run it from the TimerHandler function and i get this error: Error 1 An object reference is required for the nonstatic field, method, or property 'Update_Installer.Form1.Form1_Main()' C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\Update_Installer\Update_Installer\Update_Installer\Form1.cs 121 13 Update_Installer this is the TimerFunction: private static void TimerHandler(Object myObject, EventArgs myEventArgs) { Form1_Main(); } What i am doing wrong? Thanks :)
-
Hi! I need to activate a function after 5 seconds that the form is running, i created this void fnction in the general class of the project and now i am trying to run it from the TimerHandler function and i get this error: Error 1 An object reference is required for the nonstatic field, method, or property 'Update_Installer.Form1.Form1_Main()' C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\Update_Installer\Update_Installer\Update_Installer\Form1.cs 121 13 Update_Installer this is the TimerFunction: private static void TimerHandler(Object myObject, EventArgs myEventArgs) { Form1_Main(); } What i am doing wrong? Thanks :)
Are you accessing a normal method withing a static one. In that case, you need to have an instance member and then call the normal method using the instance member right?
Vasudevan Deepak Kumar Personal Homepage Tech Gossips
-
Hi! I need to activate a function after 5 seconds that the form is running, i created this void fnction in the general class of the project and now i am trying to run it from the TimerHandler function and i get this error: Error 1 An object reference is required for the nonstatic field, method, or property 'Update_Installer.Form1.Form1_Main()' C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\Update_Installer\Update_Installer\Update_Installer\Form1.cs 121 13 Update_Installer this is the TimerFunction: private static void TimerHandler(Object myObject, EventArgs myEventArgs) { Form1_Main(); } What i am doing wrong? Thanks :)
Are you sure you need your handler to be static? I never do...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi! I need to activate a function after 5 seconds that the form is running, i created this void fnction in the general class of the project and now i am trying to run it from the TimerHandler function and i get this error: Error 1 An object reference is required for the nonstatic field, method, or property 'Update_Installer.Form1.Form1_Main()' C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\Update_Installer\Update_Installer\Update_Installer\Form1.cs 121 13 Update_Installer this is the TimerFunction: private static void TimerHandler(Object myObject, EventArgs myEventArgs) { Form1_Main(); } What i am doing wrong? Thanks :)
If i do not do it as static i am getting this error: Error 1 An object reference is required for the nonstatic field, method, or property 'Update_Installer.Form1.TimerHandler(object, System.EventArgs)' C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\Update_Installer\Update_Installer\Update_Installer\Form1.cs 112 31 Update_Installer