السلام عليكم
هذا الموضوع استكمال لدورة الاكواد الشاملة 
هذا الموضوع خاص بالادوات :  اداة TextBox 
بيئة العمل : VB.NET 2019 - يعمل على جميع اصدارات VB.NET
============================================
'26-افراغ جميع ادوات التكست دفعة واحدة
كود PHP:
Public Class Form1
    Public Sub ClearTextBox(ByVal Root As Control)
        For Each Ct As Control In Root.Controls
            If TypeOf Ct Is TextBox Then
                CType(Ct, TextBox).Clear()
            End If
        Next
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ClearTextBox(Me)
    End Sub
End Class
'26-افراغ جميع ادوات التكست دفعة واحدة 
 
'27-افراغ جميع التكست الموجودة داخل كروب بوكس
كود PHP:
Public Class Form1
    Private Sub ClearForm()
        Dim obj As Control, objGrp As Control
        For Each obj In Form.ActiveForm.Controls
            If TypeOf obj Is GroupBox Then
                For Each objGrp In obj.Controls
                    If TypeOf objGrp Is TextBox Then
                        If objGrp.Name <> "txtCNO" _
                        Then objGrp.ResetText()
                    End If
                Next objGrp
            End If
        Next obj
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ClearForm()
    End Sub
End Class
'27-افراغ جميع التكست الموجودة داخل كروب بوكس