0

I have two form: Form1 and Form2. Both of it already have data.

  • After I scan barcode in Form1, Fom1 will be hidden, Form2 will show and somethings.

  • After Form2 finish, Form1 will show again and Form2 will be hidden.

It's cycle.

I tried with:

///In Form1
Frm2 Form2 = new Frm2();
Form2.show();
this.Hide();

///In Form2
Frm1 Form1 = new Frm1();
Form1.show();
this.Hide();

But i think it make a new form with no data.

So, how can i unhide form which was hidden?

MrAngel
  • 3
  • 3
  • Not yet, i still finding solution – MrAngel May 08 '21 at 02:40
  • Did you read the code you posted? You create `Form2` twice, show it twice, and then use `this` without any idea what `this` references. – Ken White May 08 '21 at 03:23
  • @MrAngel If you want only one instance of Form2, then don't create it every time you want to show it. Create instance of Form2 somewhere in constructor of Form1 and then only show/hide when needed. – Dzianis Karpuk May 08 '21 at 03:32
  • @KenWhite sr. it's my bad. It's for Frm1 form2 = new Frm1. – MrAngel May 08 '21 at 05:02
  • @DzianisKarpuk can u give example? I need only hide and unhide it – MrAngel May 08 '21 at 05:03
  • Can anyone answer me who can close this post. It's not same problem with link i receved. https://stackoverflow.com/questions/1665533/communicate-between-two-windows-forms-in-c-sharp – MrAngel May 08 '21 at 05:20
  • @MrAngel no, your question is closed, it is unsuitable to post code in comment. – Dzianis Karpuk May 08 '21 at 13:34

0 Answers0