Tuesday 15 May 2012

c# - How to properly rename WinForms controls? -


I have just started that with my first GUI app (Windows Form) C #, with Visual Studio 2012, and I'm surprised by the name of all the controls handling the IDE of the property:

- I add a rich textbox to my form using the toolbox

- (name) The property is set to a default value of Auto: richTextBox1

- I can add value (name) to something more I change it like: richTextBoxResults

- When I try to use it (like within my Form 1 () method) IDE thinks it is not existence

- This line causes a compile error: richTextBoxResults.AppendText ("a");

Error 1 The object reference for non-stationary field, method or property is required 'Foo.Form1.richTextBoxResults'.

I will look at two things.

1) Make sure you have saved the form in question 2) When problems arise - try to reconstruct the solution (with code compilation)

This is usually To ensure that the refresh of the code will trigger that it can see it. If you still have problems - you are trying to use control from the wrong location or you have a misspelling (this case is sensitive).

No comments:

Post a Comment