An object reference is required for the non-static field, method, or property using global variable

Posted by Jose Cardama on Stack Overflow See other posts from Stack Overflow or by Jose Cardama
Published on 2013-10-17T15:34:16Z Indexed on 2013/10/17 15:55 UTC
Read the original article Hit count: 183

Filed under:
|

Hello Iam working in a global int in which a variable will be used later. I've made the global variable like this:

    class Foo
    {
       public static int stream = Bass.BASS_StreamCreateFile(path1.Text, 0, 0, BASSFlag.BASS_DEFAULT);
    }

which will be later called like this:

Foo.stream

and it can also contain more then 1 stream for example stream20,30,etc...

The problem here is that it returns me this error:

"An object reference is required for the non-static field, method, or property" where I call the text in path1.Text

How do I fix this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about bass