G
G
Gina Lee2016-04-27 19:04:38
C++ / C#
Gina Lee, 2016-04-27 19:04:38

How beautiful is the transition from one form to another in Windows Forms?

Hello toaster!
I'm learning C#, I need to write a small application on Windows Forms, I don't know who to consult with, I hope for a helping hand here.
I want to make it so that form1 is created, you press a button on it, form1 is deleted (through Dispose, not through Hide), and form2 opens. How can I do this better? Create form2 in form1 constructor or button1_Click? store a link to form2 in form1? or how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zelimkhan Beltoev, 2016-04-27
@Din7

Apparently, before starting the program, you need to choose in the starting form, with which form in the program to work further?
Open Program.cs and before the lines...

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());

... insert a call to your form1 (ShowDialog), and from the results (Form.DialogResult) that it returns, start the application using the form you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question