how to declare a public string with a textbox's text

Posted by Ian Lundberg on Stack Overflow See other posts from Stack Overflow or by Ian Lundberg
Published on 2012-03-26T11:24:36Z Indexed on 2012/03/26 11:30 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

i am trying to do

      public string str = txtText.Text;

but it wont let me use txtText.txt so how would I declare that so it can be used everywhere?

I can't use it in the button1_click event because if I do it messes it up because I am having a string retrieve from the textbox and set to the textbox so it doesn't work right so I have to have it retrieve the textbox's text somewhere else then set to it.

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms