Form1 to Form2
-
Hai I am new to WinForms how to close Form1 when I moved to Form2 in a button click...
try until u succeed
-
Hai I am new to WinForms how to close Form1 when I moved to Form2 in a button click...
try until u succeed
-
at the buttin click event create an instance of current form and the form u want open..try sumthing like this At button click event: currentform form1=new currentform(); formToOpen form2=new formToOpen(); form1.hide(); form2.show(); bye
Rahul83 wrote:
currentform form1=new currentform();
I'm sorry, but that plain will not work. It creates a new Form1, which will have no bearing on the one that is visible.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Hai I am new to WinForms how to close Form1 when I moved to Form2 in a button click...
try until u succeed
You can call Hide() to hide the visible form, and then show form2 using ShowDialog() if you want a modal form ( I presume you do, why would you want a modeless form attached to an invisible form ? ) A better approach is to define both forms as user controls and put them on the one form, and just swap which one is visible.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )