|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
split containerHi !
If I put on a form a split container , in the left side a main menu and here is the question how I can put in the right side - in Panel2- a form that is executed when i choose an option from the menu.? Is any example somewhere? I serched in MSDN but i cannot find something like that. I saw outlook 2003 has a behavior like this.. Regards, Mihai Mihai,
I have a report menu which does exactly this. Depending of which report is selected in a grid I load a different form as a subform or midi child. Like this: ************************************************************** Public Sub LoadForm(ByVal Name As String, ByRef Parent As Form) Try If Not SubForm Is Nothing Then SubForm.Close() SubForm = Nothing GC.Collect() End If Dim objNewForm As Object = Activator.CreateInstance(Type.GetType(Name)) SubForm = DirectCast(objNewForm, Form) SubForm.StartPosition = FormStartPosition.Manual SubForm.MdiParent = Parent SubForm.Location = New Point(0, 163) SubForm.Show() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly) End Try End Sub *************************************************************** If anyone has a better method for doing this, I would be interested in seeing it. Hope this helps, Izzy Mihai wrote: Show quoteHide quote > Hi ! > If I put on a form a split container , in the left side a main menu and here > is the question how I can put in the right side - in Panel2- a form that is > executed when i choose an option from the menu.? > Is any example somewhere? I serched in MSDN but i cannot find something like > that. I saw outlook 2003 has a behavior like this.. > > Regards, > Mihai Thanks Izzy !
I will try. ! Mihai Show quoteHide quote "Izzy" <israel.rich***@gmail.com> wrote in message news:1159195362.681576.75310@m73g2000cwd.googlegroups.com... > Mihai, > > I have a report menu which does exactly this. Depending of which report > is selected in a grid I load a different form as a subform or midi > child. > > Like this: > > ************************************************************** > > Public Sub LoadForm(ByVal Name As String, ByRef Parent As Form) > > Try > If Not SubForm Is Nothing Then > SubForm.Close() > SubForm = Nothing > GC.Collect() > End If > > Dim objNewForm As Object = > Activator.CreateInstance(Type.GetType(Name)) > SubForm = DirectCast(objNewForm, Form) > SubForm.StartPosition = FormStartPosition.Manual > SubForm.MdiParent = Parent > SubForm.Location = New Point(0, 163) > SubForm.Show() > Catch ex As Exception > MsgBox(ex.Message, MsgBoxStyle.OKOnly) > End Try > > End Sub > > *************************************************************** > > If anyone has a better method for doing this, I would be interested in > seeing it. > > Hope this helps, > Izzy > > Mihai wrote: > > Hi ! > > If I put on a form a split container , in the left side a main menu and here > > is the question how I can put in the right side - in Panel2- a form that is > > executed when i choose an option from the menu.? > > Is any example somewhere? I serched in MSDN but i cannot find something like > > that. I saw outlook 2003 has a behavior like this.. > > > > Regards, > > Mihai > Izzy wrote:
> There is almost *never* any reason to call GC.Collect. Calling the> Like this: > > ************************************************************** > > Public Sub LoadForm(ByVal Name As String, ByRef Parent As Form) > > Try > If Not SubForm Is Nothing Then > SubForm.Close() > SubForm = Nothing > GC.Collect() > End If form's Close method will result in the form getting disposed. Another way to show a form inside a panel is to just set the form's TopLevel property to false and set it's parent to the panel (this code is from my head, watch for typos): Dim frm As New SubForm() frm.TopLevel = False frm.parent = SplitContainer1.Panel2; frm.Dock = Dock.Fill frm.Show() Instead of using a Form, you might consider also using a UserControl. Chris
Windows Service, timer doesn't tick
Copy Directory Any examples of this floating around? Difference between CDec and CDbl Help with some research multi line list box ComboBox-binding an ein gefiltertes Dataset.Table-Object Getting A generic error occurred in GDI+ message VB.NET AND 3D Run Adobe Acrobat from within VB.Net app |
|||||||||||||||||||||||