In the Child Form - changes shown in bold
#Region " Windows Form Designer generated code "
Public Sub New(ByVal CalledBy As Form1)
MyBase.New()
[b]'This line MUST come BEFORE the call to InitializeComponent()
MyParent = CalledBy[/b]
'This call is required by the Windows Form Designer.
InitializeComponent()
[b]ShowLoadProgress()[/b]
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents NumericUpDown1 As System.Windows.Forms.NumericUpDown
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown
Me.Button2 = New System.Windows.Forms.Button
Me.ListBox1 = New System.Windows.Forms.ListBox
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Button1
[b]ShowLoadProgress()[/b]
'
Me.Button1.Location = New System.Drawing.Point(48, 32)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'NumericUpDown1
[b]ShowLoadProgress()[/b]
'
Me.NumericUpDown1.DecimalPlaces = 2
Me.NumericUpDown1.Increment = New Decimal(New Integer() {1, 0, 0, 131072})
Me.NumericUpDown1.Location = New System.Drawing.Point(152, 24)
Me.NumericUpDown1.Maximum = New Decimal(New Integer() {15000, 0, 0, 0})
Me.NumericUpDown1.Minimum = New Decimal(New Integer() {15000, 0, 0, -2147483648})
Me.NumericUpDown1.Name = "NumericUpDown1"
Me.NumericUpDown1.TabIndex = 1
Me.NumericUpDown1.Value = New Decimal(New Integer() {775, 0, 0, 131072})
'
'Button2
[b]ShowLoadProgress()[/b]
'
Me.Button2.Location = New System.Drawing.Point(56, 88)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 2
Me.Button2.Text = "Button2"
'
[b]ShowLoadProgress()[/b]
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(168, 72)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(352, 199)
Me.ListBox1.TabIndex = 3
'
'ChildForm1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(608, 309)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.NumericUpDown1)
Me.Controls.Add(Me.Button1)
Me.Name = "ChildForm1"
Me.Text = "ChildForm1"
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private MyParent As Form1
Private LoadProgress As Integer = 1
Private Sub ShowLoadProgress()
'only a few controls on this form - pretend there are more
For a As Integer = 0 To 1000
For b As Integer = 0 To 100000
Dim c As Double = a * b
Next
Next
'update progress bar on MDI Parent
LoadProgress += 1
MyParent.labelMiddle.Width = (MyParent.panelMiddle.Width \ [b]5[/b]) * LoadProgress
MyParent.labelMiddle.Refresh()
End Sub