Found the following interesting discussion in the Newsgroups:
| Moving between forms in VB.NET by:stmthoma@gapac.com (Steven Thomas) | |
| Ok, I am a newbee at vb.net and I have written an application with multiple forms. I have created a form named frmbase with all other forms are inherited from. frmbase has my menu on it. I have set frmbase as the startup form. This all works great, however when I go to form 2 I get a new window, and I would like for it to stay in the same window that frmBase was in so I don't have lots of windows open as a user is working. Can someone point in the right direction to do this? Thanks | |
| Reply: by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP]) | |
Instead of designing forms, design usercontrols that are dynamically instantiated/removed from the form. -- Herfried K. Wagner [MVP] | |
| Reply: by:Steven Thomas | |
| Sounds good but I have about 20 forms built and working. Is there not a better way to do this? If not is there and easy way to covert my forms to controls? Don't just participate in USENET...get rewarded for it! | |
| Reply: by:Chris Dunaway | |
| On Wed, 16 Jun 2004 09:26:19 -0700, Steven Thomas wrote: One method is to open the forms inside the main form. In the main form, add a panel to hold the other forms. For each of the other forms, set their border style to None. Then to load the form into the panel, do something like this (check syntax) Private Sub LoadFormIntoPanel() Dim MyForm2 as New Form2 MyForm2.Size = pnlContent.Size MyForm2.TopLevel = False MyForm2.Parent = pnlContent MyForm2.Show End Sub This code will show the form inside the panel. Be sure that, as you load and unload forms, you dispose of them properly, etc. This should give you some ideas. I don't know if it's better, but you wont have to change your forms. -- Chris | |
| Reply: by:stmthoma@gapac.com (Steven Thomas) | |
| Chris Thanks for then info. It seems simple enough. However I got the first form to load in the panel. Then how do I close it and load the second. I don't seem to be able to determine which form is loaded and how to close it? | |
Posted by Xander Zelders

0 Comments:
Post a Comment
<< Home