Hello :)
I have a textbox in a form which is accessed by another form, and i can't understand why the textbox text is null.
adaugaPolitaRca adaugare1 = (adaugaPolitaRca)Application.OpenForms["adaugaPolitaRca"];
TextBox tb = adaugare1.codClientTxt;
MessageBox.Show(tb.Text);//displays nothing even though i write text in the textbox
Does anybody know what's wrong?
Loading


VulpesRank #55 · 29.2K reputationPosted Apr 25, 2013, 1:33 AM EDT
If you are sure, then is that code running in a different thread to the main UI thread?
Violeta Popa132 reputationPosted Apr 25, 2013, 1:44 AM EDT
If so..this code is not running from the main form.
To be more explicit, in the main form i have a button, when i click this button "adaugare1" form is opened, here is the codClientTxt...i write text in that textbox and I have another button in this form, when i click it the code above runs.
VulpesRank #55 · 29.2K reputationPosted Apr 25, 2013, 4:34 AM EDT
Just as an experiment, insert the highlighted line and see if it changes Form2's title to what's in the texbox:
this.Text = tb.Text;
VulpesRank #55 · 29.2K reputationPosted Apr 25, 2013, 6:42 AM EDT
Years ago there was a problem with McAfee's antivirus software which caused message boxes not to display anything.
They eventually issued a patch for it though you could temporarily fix it by disabling buffer overrun checks in the McAfee console.
If you're running an antivirus program, I'd try temporarily disabling it to see whether this could be anything to do with the problem you're currently experiencing.
Violeta Popa132 reputationPosted Apr 25, 2013, 2:19 PM EDT
Violeta Popa132 reputationPosted Apr 25, 2013, 2:43 PM EDT
VulpesRank #55 · 29.2K reputationPosted Apr 25, 2013, 3:14 PM EDT