Hello
I have a button and a text box. Why I can't access text box out of button_click method or other methods ?
Thanks :-
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sam HobbsRank #107 · 20.5K reputationPosted Aug 15, 2010, 8:14 AM EDT
Majid KamaliRank #6,453 · 266 reputationPosted Aug 15, 2010, 8:45 AM EDT
For example in class Form1, out of any method, I can't write something like this :
string m = TextBox1.Text;
Sam HobbsRank #107 · 20.5K reputationPosted Aug 15, 2010, 9:20 AM EDT
Majid KamaliRank #6,453 · 266 reputationPosted Aug 15, 2010, 10:17 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Aug 15, 2010, 11:55 AM EDT
Majid KamaliRank #6,453 · 266 reputationPosted Aug 16, 2010, 4:21 AM EDT