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.
Change your declaration to this (I guess you’re trying to make public your TextBox Text property):
If you simply want to get that value inside your event handler (and inside the same class where your TextBox is declared) then you don’t have to use the public specifier in the declaration: