SlammingRumJoe
Newcomer
- Joined
- Jan 25, 2005
- Messages
- 1
Guys,
I have created a simple form with a large panel in the middle. Instead of using multiple forms i thought that i would use one form with a panel which contains a UserControl. Instead of hiding one form and showing another (i couldnt get them to appear in exactly the same location!) I was clearing the controls collection of the panel and adding a new usercontrol to it.
The only problem is that i am clearing the controls collection of the panel from a control in the panel. Is this possible?
Here is the code that i was using:
Dim asd As frmMain ' the form on which the main panel - pnlMainPage - resides
'
asd = Me.ParentForm
asd.ClearMainPanel()
asd.pnlMainPage.Controls.Clear()
'
Dim ucPers As New ucPersonalInfo ' new usercontrol
'
asd.pnlMainPage.Controls.Add(ucPers)
ucPers = Nothing
'
asd = Nothing
This works but everytime the application is minimised or loses focus after this it is impossible to get it back into focus. What am i doing wrong? I am a Web Developer and am havnig much trouble adapting to this windows forms thing.
Help!
I have created a simple form with a large panel in the middle. Instead of using multiple forms i thought that i would use one form with a panel which contains a UserControl. Instead of hiding one form and showing another (i couldnt get them to appear in exactly the same location!) I was clearing the controls collection of the panel and adding a new usercontrol to it.
The only problem is that i am clearing the controls collection of the panel from a control in the panel. Is this possible?
Here is the code that i was using:
Dim asd As frmMain ' the form on which the main panel - pnlMainPage - resides
'
asd = Me.ParentForm
asd.ClearMainPanel()
asd.pnlMainPage.Controls.Clear()
'
Dim ucPers As New ucPersonalInfo ' new usercontrol
'
asd.pnlMainPage.Controls.Add(ucPers)
ucPers = Nothing
'
asd = Nothing
This works but everytime the application is minimised or loses focus after this it is impossible to get it back into focus. What am i doing wrong? I am a Web Developer and am havnig much trouble adapting to this windows forms thing.
Help!