How to switch forms?
-
I have an interface problem, trying to write a program in C#, which I'd really appreciate some help on. It's an SDI app, and I want basically to switch the main form to a different one. So to start with there's one form, but on editing one of the entries I want to switch to a different one, so I can lay out a different set of controls on the other form. I'm not sure how to do this in C#? I hope you can understand what I'm trying to do, and I'd appreciate any advice! Thanks, Mark
-
I have an interface problem, trying to write a program in C#, which I'd really appreciate some help on. It's an SDI app, and I want basically to switch the main form to a different one. So to start with there's one form, but on editing one of the entries I want to switch to a different one, so I can lay out a different set of controls on the other form. I'm not sure how to do this in C#? I hope you can understand what I'm trying to do, and I'd appreciate any advice! Thanks, Mark
Hi. I don´t know if I have understood you correctly but here is an idea, I hope you can use it. You create another form, From f1 = new Form(); and then call the show method: f1.Show(); You can of course add the controls you like to that new form and set it´s size just like on any other form. Hope this helps, F
-
Hi. I don´t know if I have understood you correctly but here is an idea, I hope you can use it. You create another form, From f1 = new Form(); and then call the show method: f1.Show(); You can of course add the controls you like to that new form and set it´s size just like on any other form. Hope this helps, F
Thanks for your reply. The problem with that is it will open a new form, what I want to do is replace the existing form with the new one. I don't know how to do it in an SDI app, in an MDI app you can open a new child form, the problem is the user can restore the forms and switch between them, I want it to appear as an SDI app.
-
Thanks for your reply. The problem with that is it will open a new form, what I want to do is replace the existing form with the new one. I don't know how to do it in an SDI app, in an MDI app you can open a new child form, the problem is the user can restore the forms and switch between them, I want it to appear as an SDI app.
Hi. Perhaps you can set your existing controls (textboxes, radiobuttons etc) to disappear, you can set their property. For instance, if have a TextBox on your form, txtbox2, you can: txtbox2.Visible = false; and it will then not be seen by the user. That way you can make some or all of the controls disappear and then create new ones if need be. I don´t know if I fully understand your problem but I hope this helps. F