I am writing a program that requires toggling between 2 forms. I thought I could use the Hide and Show methods but I need a way for the forms to know about each other so they can Hide themselves and Show the other form. Initially, form1 instantiates form2
goldeneagle217
0
Newbie Poster
Recommended Answers
Jump to PostYou ca ndo it this way:
//form1: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form3 f3 = new Form3(); Form2 f2 = new Form2(f3); f2.Show(); } } //form2: public partial class Form2 : Form { …
Jump to Postsimply hide the form2 (which will show from1). And when you need to show form2 again, just call form2.Show() method. thats it.
Mitja
All 5 Replies
Mitja Bonca
557
Nearly a Posting Maven
goldeneagle217
0
Newbie Poster
Mitja Bonca
557
Nearly a Posting Maven
zachattack05
70
Posting Pro in Training
goldeneagle217
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.