S
Simon Verona
I have a parent form which contains a toolbar. The toolbar controls the
loading and switching to of MDI child forms.
The code for the toolbar click event and one of the subroutines that loads
and shows a child form is:
Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbMenu.ButtonClick
Dim btn As System.Windows.Forms.ToolBarButton
For Each btn In Me.tbMenu.Buttons
If Me.Tag = e.Button.Tag Then
btn.Pushed = True
Else
btn.Pushed = False
End If
Next
Select Case e.Button.Tag
Case "0"
AccountEnquiry()
Case "1"
PostInvoice()
Case "99"
Me.Close()
End Select
End Sub
Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
..SuspendLayout()
..MdiParent = Me
..WindowState = Windows.Forms.FormWindowState.Maximized
..BringToFront()
..Show()
..ResumeLayout()
End With
Catch
frm = Nothing
AccountEnquiry()
End Try
End Sub
This works fine when the toolbar button is first clicked. The form just
loads and displays.
However, if you then click to another child form and then click back, you
can see the form display and then expand to maximised within the parent form
which flickers and is annoying. I tried inserting the suspendlayout and
resume layouts to see if that helps but it doesn't. Can anybody suggest a
way to stop the flickering?
Thanks in advance
Simon
--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD
Tel: 0870 080 2300
Fax: 0870 735 0011
loading and switching to of MDI child forms.
The code for the toolbar click event and one of the subroutines that loads
and shows a child form is:
Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbMenu.ButtonClick
Dim btn As System.Windows.Forms.ToolBarButton
For Each btn In Me.tbMenu.Buttons
If Me.Tag = e.Button.Tag Then
btn.Pushed = True
Else
btn.Pushed = False
End If
Next
Select Case e.Button.Tag
Case "0"
AccountEnquiry()
Case "1"
PostInvoice()
Case "99"
Me.Close()
End Select
End Sub
Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
..SuspendLayout()
..MdiParent = Me
..WindowState = Windows.Forms.FormWindowState.Maximized
..BringToFront()
..Show()
..ResumeLayout()
End With
Catch
frm = Nothing
AccountEnquiry()
End Try
End Sub
This works fine when the toolbar button is first clicked. The form just
loads and displays.
However, if you then click to another child form and then click back, you
can see the form display and then expand to maximised within the parent form
which flickers and is annoying. I tried inserting the suspendlayout and
resume layouts to see if that helps but it doesn't. Can anybody suggest a
way to stop the flickering?
Thanks in advance
Simon
--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD
Tel: 0870 080 2300
Fax: 0870 735 0011