I have created a parent form and a child form in c# when i click a menu item in parent form, it opens the child form but still i access the parent form.i want that the parent form will remain inaccesible until the child form is open.please send me the 开发者_StackOverflow社区code.thnks
try with this
form.ShowDialog()
Probably you should use form.ShowDialog()
method instead of form.Show()
Definitely you should add a better description, at least framework you are using (WinForms?). C# is not a framework.
Use, form.Hide()
process to make the Parent form to be not accessable when ever the child form opens and again give form.show()
to activate the parent form.
If you want your parent form visible while showing your child form then you can do following.
form.ShowDialog(this).
Where this
is the instance of your parent form.
On the other hand, if you want your parent form hide while showing child form you can do following
this.Hide();
form.ShowDialog(this)
精彩评论