Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Referance Problem

Referance Problem

Scheduled Pinned Locked Moved C#
helpcsharpvisual-studioquestionannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    ytubis
    wrote on last edited by
    #1

    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 :)

    V L Y 3 Replies Last reply
    0
    • Y ytubis

      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 :)

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • Y ytubis

        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 :)

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        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


        1 Reply Last reply
        0
        • Y ytubis

          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 :)

          Y Offline
          Y Offline
          ytubis
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups