static method

I am working with winforms and in the file section I have a file that needs to be accessed from a static method.  I get the following error message on fields that are associated with that file...error code COBCH0969, Cannot access object data from a static method or field.    In order to fix these compile errors I put the keyword static on the FD of the file.  When I run the program in this way I get a runtime error of NullRefernceException -- object reference not set to an instance of an object. 

Now I realize that I could make the method as public and my problems would go away, but I really don't want to have to do this.  How can I resolve this issue?  Thanks

Tags:

Parents
  • Yeah, sorry about those two fields.  I trimmed out what wasn't necessary.  Below is the information that I believe you are looking for.

     

     

    Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel Microsoft .NET Framework Version 4.5.50709 SP1Rel

    Installed Version: IDE Standard

    Microsoft Visual Web Developer 2010   01011-532-2002361-70156 Microsoft Visual Web Developer 2010

    Hotfix for Visual Studio 2010 Shell (Integrated) - ENU (KB2549864)   KB2549864 This hotfix is for Visual Studio 2010 Shell (Integrated) - ENU. If you later install a more recent service pack, this hotfix will be uninstalled automatically. For more information, visit support.microsoft.com/.../2549864.

    Hotfix for Visual Studio 2010 Shell (Integrated) - ENU (KB2635973)   KB2635973 This hotfix is for Visual Studio 2010 Shell (Integrated) - ENU. If you later install a more recent service pack, this hotfix will be uninstalled automatically. For more information, visit support.microsoft.com/.../2635973.

    Micro Focus Visual COBOL 2.2   Serial number: 110000205879 Micro Focus Visual COBOL 2.2 Version 2.2.00244. Serial number: 110000205879 Full license For more information, visit http://www.microfocus.com. Copyright (C) Micro Focus 1984-2013. All rights reserved.

    Security Update for Visual Studio 2010 Shell (Integrated) - ENU (KB2645410)   KB2645410 This security update is for Visual Studio 2010 Shell (Integrated) - ENU. If you later install a more recent service pack, this security update will be uninstalled automatically. For more information, visit support.microsoft.com/.../2645410.

    Visual Studio 2010 Shell (Isolated) - ENU Service Pack 1 (KB983509)   KB983509 This service pack is for Visual Studio 2010 Shell (Isolated) - ENU. If you later install a more recent service pack, this service pack will be uninstalled automatically. For more information, visit support.microsoft.com/.../983509.

Reply
  • Yeah, sorry about those two fields.  I trimmed out what wasn't necessary.  Below is the information that I believe you are looking for.

     

     

    Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel Microsoft .NET Framework Version 4.5.50709 SP1Rel

    Installed Version: IDE Standard

    Microsoft Visual Web Developer 2010   01011-532-2002361-70156 Microsoft Visual Web Developer 2010

    Hotfix for Visual Studio 2010 Shell (Integrated) - ENU (KB2549864)   KB2549864 This hotfix is for Visual Studio 2010 Shell (Integrated) - ENU. If you later install a more recent service pack, this hotfix will be uninstalled automatically. For more information, visit support.microsoft.com/.../2549864.

    Hotfix for Visual Studio 2010 Shell (Integrated) - ENU (KB2635973)   KB2635973 This hotfix is for Visual Studio 2010 Shell (Integrated) - ENU. If you later install a more recent service pack, this hotfix will be uninstalled automatically. For more information, visit support.microsoft.com/.../2635973.

    Micro Focus Visual COBOL 2.2   Serial number: 110000205879 Micro Focus Visual COBOL 2.2 Version 2.2.00244. Serial number: 110000205879 Full license For more information, visit http://www.microfocus.com. Copyright (C) Micro Focus 1984-2013. All rights reserved.

    Security Update for Visual Studio 2010 Shell (Integrated) - ENU (KB2645410)   KB2645410 This security update is for Visual Studio 2010 Shell (Integrated) - ENU. If you later install a more recent service pack, this security update will be uninstalled automatically. For more information, visit support.microsoft.com/.../2645410.

    Visual Studio 2010 Shell (Isolated) - ENU Service Pack 1 (KB983509)   KB983509 This service pack is for Visual Studio 2010 Shell (Isolated) - ENU. If you later install a more recent service pack, this service pack will be uninstalled automatically. For more information, visit support.microsoft.com/.../983509.

Children
No Data