1

In my form i have button to show other form.

But i want the previously form cannot be clicked before the new form is closed , How to create that ?

Because if the previously form is clicked, and i click the button again, the form is show multiple. this my code in button click :

MDACS_AOP_CFSTL_InputActivity addProblem = new MDACS_AOP_CFSTL_InputActivity(ParameterSesi, ParameterNamaKaryawan, ParameterTanggal);
                    //addProblem.Close();
                    addProblem.Show();
Enkhay
  • 232
  • 2
  • 4
  • 16
  • 1
    Try if MDACS_AOP_CFSTL_InputActivity provides a ShowDialog() method. –  Apr 29 '14 at 08:42

3 Answers3

3

You should use

addProblem.ShowDialog(this);

This will open the dialog as child of the parent (this) dialog. You cant click the parent dialog but you can still see it.

Relax
  • 283
  • 2
  • 15
1

You could use

 MDACS_AOP_CFSTL_InputActivity addProblem = new MDACS_AOP_CFSTL_InputActivity(ParameterSesi, ParameterNamaKaryawan, ParameterTanggal);
 this.Hide;
 addProblem.ShowDialog();
 this.Show();

The show(); command will not be executed until the dialog is close. So it will stay hidden

Poomrokc The 3years
  • 1,099
  • 2
  • 10
  • 23
  • Thanks the code works, but i dont need hide the form, i just use the ShowDialog() and thats work thank you. – Enkhay Apr 29 '14 at 08:45
  • 1
    Just want to add for information that if you use "this" the scope will be changed when new pop up shown. either you can use the form name directly. :D – Shaikh Farooque Apr 29 '14 at 08:49
1

You need to use

addProblem.ShowDialog();

instead of

addProblem.Show();

so that it will open a modal dialog.

Shaikh Farooque
  • 2,620
  • 1
  • 19
  • 33