Private Function PopulateGrid(ByVal a_enumRecType As BAA_ENUM_Record_Types) As Boolean
Dim l_strCaption As String = ""
Dim l_dgrid_baa_records As New System.Windows.Forms.DataGridView
Dim l_cmbFunds = New System.Windows.Forms.ComboBox
Dim l_cmbAccounts = New System.Windows.Forms.ComboBox
Dim l_grpbBottomPanel As New System.Windows.Forms.GroupBox
Dim l_lblFunds As New System.Windows.Forms.Label
Dim l_lblAccounts As New System.Windows.Forms.Label
Try
CType(l_dgrid_baa_records, System.ComponentModel.ISupportInitialize).BeginInit()
l_grpbBottomPanel.SuspendLayout()
Me.SuspendLayout()
' Create a new instance of the child form.
Dim ChildForm As New System.Windows.Forms.Form
' Make it a child of this MDI form before showing it.
ChildForm.MdiParent = Me
ChildForm.AutoScroll = True
ChildForm.AutoSize = True
ChildForm.WindowState = FormWindowState.Maximized
ChildForm.BackColor = Color.LightYellow
m_ChildFormNumber += 1
ChildForm.Name = m_ChildFormNumber.ToString
'-------------------------------------------------------------------------------
l_dgrid_baa_records.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
l_dgrid_baa_records.Location = New System.Drawing.Point(2, 3)
l_dgrid_baa_records.ScrollBars = ScrollBars.Both
l_dgrid_baa_records.Name = "grid_records"
l_dgrid_baa_records.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Sunken
l_dgrid_baa_records.AutoResizeColumns()
l_dgrid_baa_records.Size = New System.Drawing.Size(639, 333)
l_dgrid_baa_records.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
l_dgrid_baa_records.TabIndex = 0
' Alternate row colours from light gray to light yellow.
l_dgrid_baa_records.RowsDefaultCellStyle.BackColor = Color.LightGray
l_dgrid_baa_records.AlternatingRowsDefaultCellStyle.BackColor = Color.LightYellow
'-------------------------------------------------------------------------------
' Create group box going across the bottom.
l_grpbBottomPanel.Controls.Add(l_lblFunds)
l_grpbBottomPanel.Controls.Add(l_lblAccounts)
l_grpbBottomPanel.Controls.Add(l_cmbFunds)
l_grpbBottomPanel.Controls.Add(l_cmbAccounts)
l_grpbBottomPanel.Location = New System.Drawing.Point(2, 341)
l_grpbBottomPanel.Name = "bottom_panel"
l_grpbBottomPanel.Size = New System.Drawing.Size(638, 83)
l_grpbBottomPanel.TabIndex = 1
l_grpbBottomPanel.BackColor = Color.LightGray
'-------------------------------------------------------------------------------
' Create group box going across the bottom.
l_lblFunds.Text = "Funds:"
l_lblFunds.Location = New System.Drawing.Point(20, 15)
l_lblFunds.Size = New System.Drawing.Size(60, 20)
l_lblAccounts.Text = "Accounts:"
l_lblAccounts.Location = New System.Drawing.Point(305, 15)
l_lblAccounts.Size = New System.Drawing.Size(60, 20)
'-------------------------------------------------------------------------------
' Funds drop down list box.
l_cmbFunds.Name = "cmb_funds"
l_cmbFunds.FormattingEnabled = True
l_cmbFunds.Location = New System.Drawing.Point(20, 35)
l_cmbFunds.Size = New System.Drawing.Size(244, 25)
l_cmbFunds.TabIndex = 2
' Accounts drop down list box.
l_cmbAccounts.Name = "cmb_accounts"
l_cmbAccounts.FormattingEnabled = True
l_cmbAccounts.Location = New System.Drawing.Point(305, 35)
l_cmbAccounts.Size = New System.Drawing.Size(312, 25)
l_cmbAccounts.TabIndex = 3
'-------------------------------------------------------------------------------
ChildForm.Text = l_strCaption & " " & m_ChildFormNumber
' Populate the grid with data.
GetRecords(l_dgrid_baa_records, a_enumRecType)
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(646, 432)
'Add the grid to the midi form.
ChildForm.Controls.Add(l_grpbBottomPanel)
ChildForm.Controls.Add(l_dgrid_baa_records)
CType(l_dgrid_baa_records, System.ComponentModel.ISupportInitialize).EndInit()
l_grpbBottomPanel.ResumeLayout(False)
Me.ResumeLayout(False)
ChildForm.Show()
PopulateGrid = True
Catch ex As Exception
m_objAppLog.WriteErrorLineToAppLogFile(ex)
Finally
End Try
End Function
Friend WithEvents l_cmbFund As System.Windows.Forms.ComboBox
Friend WithEvents l_cmbAccounts As System.Windows.Forms.ComboBox
Friend WithEvents l_dgrid_baa_records As System.Windows.Forms.DataGridView
Friend WithEvents l_grpbBottomPanel As System.Windows.Forms.GroupBox
Private Sub l_cmbFund_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles l_cmbFund.SelectedIndexChanged
MessageBox.Show("Hi")
End Sub
Open in new window