开发者

parent form is accessible when child form is open

开发者 https://www.devze.com 2023-03-08 10:35 出处:网络
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 inaccesi

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消