3
Reply

Problem with Minimized Main Form

Ask a question
Hi Guys
Can you please take a look at following app to see what I am doing wrong?


Download App(WinFormsStarts)

What I want to do is running multiple modal forms AND keeping the MainApp form accessible until finishing all required modals.As you can see from the application, as soon as you run the program the MainApp form (in Maximized windows State) and the Welcome form pops up.
till here everything is fine but when I chose the "Start New Project" the QuickStart form pops up BUT the MainApp minimize which is not meant to be.
This issue also happen when user chose the "Start Existing Project" then the MainApp minimize again and the Open dialog appear on the screen.

Here are the codes ,as well:
1- MainApp



  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace WinFormStarts
  10. {
  11. public partial class MainApp : Form
  12. {
  13. public MainApp()
  14. {
  15. InitializeComponent();
  16. }
  17. private void MainApp_Load(object sender, EventArgs e)
  18. {
  19. Welcome welcomeForm = new Welcome();
  20. welcomeForm.ShowDialog();
  21. }
  22. }
  23. }



2- Welcome Form

  1. using System.ComponentModel;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Windows.Forms;
  7. namespace WinFormStarts
  8. {
  9. public partial class Welcome : Form
  10. {
  11. public Welcome()
  12. {
  13. InitializeComponent();
  14. }
  15. private void btnExisting_Click(object sender, EventArgs e)
  16. {
  17. this.Hide();
  18. OpenFileDialog dlg = new OpenFileDialog();
  19. dlg.ShowDialog();
  20. }
  21. private void btnCancel_Click(object sender, EventArgs e)
  22. {
  23. this.Close();
  24. Application.Exit();
  25. }
  26. private void btnNew_Click(object sender, EventArgs e)
  27. {
  28. this.Hide();
  29. QuickStart qs = new QuickStart();
  30. qs.ShowDialog();
  31. }
  32. }
  33. }



3- QuickStart Form

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace WinFormStarts
  10. {
  11. public partial class QuickStart : Form
  12. {
  13. public QuickStart()
  14. {
  15. InitializeComponent();
  16. }
  17. private void button2_Click(object sender, EventArgs e)
  18. {
  19. this.Close();
  20. Application.Exit();
  21. }
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24. this.Close();
  25. }
  26. }
  27. }


Please let me know what is wrong with this apss. Thanks for your time in advanced

Answers (3)