robertb_NZ
Well-known member
I have a form with a splitcontainer. The left panel contains a Treeview: when a node of this is selected a form is displayed in the right panel. Here is typical code for one of the cases: -
ElseIf Action = "NewCICS" Then
Dim frm As New NewCICS
frm.TopLevel = False
frm.Parent = Me.SplitContainer1.Panel2
' Size the parent window so that NewCICS fits
SplitContainer1.Height = frm.Height
SplitContainer1.SplitterDistance = trvTemplates.Width
SplitContainer1.FixedPanel = FixedPanel.Panel1
SplitContainer1.Width = trvTemplates.Width + frm.Width
Me.Width = SplitContainer1.Width
' Display NewCICS
frm.BringToFront()
frm.Show()
This all works perfectly except for one detail: when the form is displayed the focus remains on the selected Treeview node, and you have to either click or tab to move to the first input field in the NewCICS child window. How can I have this happen automatically? I've tried adding frm.focus() either before or after frm.show(), neither makes any difference.
ElseIf Action = "NewCICS" Then
Dim frm As New NewCICS
frm.TopLevel = False
frm.Parent = Me.SplitContainer1.Panel2
' Size the parent window so that NewCICS fits
SplitContainer1.Height = frm.Height
SplitContainer1.SplitterDistance = trvTemplates.Width
SplitContainer1.FixedPanel = FixedPanel.Panel1
SplitContainer1.Width = trvTemplates.Width + frm.Width
Me.Width = SplitContainer1.Width
' Display NewCICS
frm.BringToFront()
frm.Show()
This all works perfectly except for one detail: when the form is displayed the focus remains on the selected Treeview node, and you have to either click or tab to move to the first input field in the NewCICS child window. How can I have this happen automatically? I've tried adding frm.focus() either before or after frm.show(), neither makes any difference.