For Each frm In main.MdiChildren
If TypeOf frm Is Form2 Then
Dim f2 As Form2 = CType(frm, Form2)
Dim ctls() As Control = f2.Controls.Find("dgvol", True)
If ctls.Length > 0 AndAlso TypeOf ctls(0) Is DataGridView Then
Dim dgv As DataGridView = CType(ctls(0), DataGridView)
dgv.Rows.Clear()
Exit For
End If
End If
Next
|