+ 2

How to display one form from another form in C#

Hi everyone I have app programmed by C# include 2 forms, form1 and form2, the form1 is the main form , my question is : how can I show the form2 what the code can do that

15th May 2017, 2:45 AM
AbdulHafiz Kwildy
AbdulHafiz Kwildy - avatar
4 Respuestas
+ 3
in form1 Form frm=new form2(); frm.Show(); //or frm.ShowDialog();
15th May 2017, 3:35 AM
MR Programmer
MR Programmer - avatar
+ 2
add this two line to your button Form2 frm = new Form2(); frm.Show(); https://msdn.microsoft.com/en-us/library/ws1btzy8(v=vs.90).aspx
15th May 2017, 2:55 AM
Moustafa Shahin
Moustafa Shahin - avatar
+ 2
call constructor of form 2 in actionPerformed method of your button
15th May 2017, 4:54 AM
Mayur Chaudhari
Mayur Chaudhari - avatar
0
but this code to show new form name it form2 not show me my form2
15th May 2017, 4:21 AM
AbdulHafiz Kwildy
AbdulHafiz Kwildy - avatar