Code |
as you see I create here a new "textBox" that call "textBox1".
Now, if I want to read his text (textBox1.Text), how can I do that?
I of course talk about how can I do that from another function but in the same FORM, for example:
C# |
This code above will give me an Error!
Although that he create the "textBox1" before he try display it on "MessageBox" he cant read him, and will think that he even not existent.
I explain myself best that I can, I know that have some problem with my english, but still I expect to get some answers,
thank a lot.

christopher mercado2 reputationPosted Nov 7, 2010, 5:37 PM EST
private String newBox() { TextBox textBox1 = new TextBox(); textBox1.Name = "textBox1"; textBox1.Text = "hellow"; return textBox1.Text; } private void readText() { MessageBox.Show(newBox()); }hope it helps
Sam HobbsRank #108 · 20.5K reputationPosted Nov 8, 2010, 3:29 PM EST