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
  • I just added your code to a new class in the same project.

    I had to remove the two references to the fromPidNum and the goToPidPidNum because these data items are not defined.

    I added the following to my forms class:

    invoke type BeneScreens.beneMethods::goToPid

    and it invokes the method successfully and opens the file and returns.

    I just used a dummy text file named c:\temp\returnfilebene.wrk and it all worked ok.

    What product version are you using?

    Go to Help-->About Microsoft Visual Studio and then select Visual COBOL in the list.

    What is the version number?

    Thanks.

Reply
  • I just added your code to a new class in the same project.

    I had to remove the two references to the fromPidNum and the goToPidPidNum because these data items are not defined.

    I added the following to my forms class:

    invoke type BeneScreens.beneMethods::goToPid

    and it invokes the method successfully and opens the file and returns.

    I just used a dummy text file named c:\temp\returnfilebene.wrk and it all worked ok.

    What product version are you using?

    Go to Help-->About Microsoft Visual Studio and then select Visual COBOL in the list.

    What is the version number?

    Thanks.

Children
No Data