I have some form with a menu, when I'm pressing "new" button I want to show another form. (not a child form!)
I have two forms: frmMain and frmSecond
How to show the frmSecond?
I have some form with a menu, when I'm pressing "new" button I want to show another form. (not a child form!)
I have two forms: frmMain and frmSecond
How to show the frmSecond?
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 attend4days leftRegister
AlanRank #669 · 3.6K reputationPosted May 6, 2008, 12:27 AM EDT
Try:
frmSecond f2 = new frmSecond();
f2.Show();
If you want frmSecond to maintain input focus until it is closed, use ShowDialog() instead of Show().
J8 reputationPosted May 6, 2008, 3:26 AM EDT
Great!
Thank you
J8 reputationPosted May 11, 2008, 4:44 AM EDT
AlanRank #669 · 3.6K reputationPosted May 11, 2008, 10:27 AM EDT
In frmMain, add this method to receive the string:
internal void ReceiveString(string s)
{
// put code in here to save and/or display the string somewhere, for example
textBox1.Text = s;
}
In frmSecond, add this code to transmit the string (.NET 2.0 or later assumed):
frmMain main = (frmMain)Application.OpenForms["frmMain"];
main.ReceiveString(someString);