Created
March 27, 2015 20:18
-
-
Save Microsofttechies/7092cd736798e2c79f34 to your computer and use it in GitHub Desktop.
An object reference is required for the nonstatic field, method, or property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| It looks like you are calling a non static property from a static method. You will need to either make the property static, or create an instance of class | |
| static void SetTextboxTextSafe(int result) | |
| { | |
| label1.Text = result.ToString(); | |
| } | |
| or | |
| private static void SumData(object state) | |
| { | |
| int result; | |
| //int[] icount = (int[])state; | |
| int icount = (int)state; | |
| for (int i = icount; i > 0; i--) | |
| { | |
| result += i; | |
| System.Threading.Thread.Sleep(1000); | |
| } | |
| MyClass objMyClass = new MyClass(); | |
| objMyClass.setTextboxText(result); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment