开发者

How to open a form from main form by hiding the main form

开发者 https://www.devze.com 2023-01-03 19:04 出处:网络
I would like to ask what is the best way to i开发者_运维问答mplement functionality that: User has for example 3 buttons on the main form, if he clicks on any button the form is replaced with another

I would like to ask what is the best way to i开发者_运维问答mplement functionality that:

User has for example 3 buttons on the main form, if he clicks on any button the form is replaced with another one where he has to fill some text controls and after clicking accept redirect him to the main form.

Is it done by using visible and switching it ?

I hope there is much cleaner solution

thanks for help, bye


It's essentially using the visible property of the form, but using the Form.Show() method to show the second form.

Form.Show() as far as I know is just a wrapper to changing the Visible property of the form.


I'm going to assume VB.net on this one.

You'll need to create four different forms, Form1, Form2, Form3, Form4, etc. Form1 has the buttons on it, and each other Form (2,3,4) has the text fields on it with OK buttons which will close the forms.

So, for each button in Form1:

dim tempForm as Form2 = new Form2
tempForm.showModal()  ' might be .showDialog()

And for each button in Form2,3,4

me.hide  'might be this.hide

Sorry, I get my languages mixed up sometimes :P

0

精彩评论

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

关注公众号