hi all,

i was trying to find a way to clear multiple textboxes.text in my form.

i found out about this code and tried it but having problems tracing textboxes only.

Code:
    Private Sub Clear_Fields(ByVal CForm As Form)
        Dim CControl As System.Windows.Forms.Control
        Dim tb As System.Windows.Forms.TextBox
        For Each CControl In CForm.Controls
            CControl.Text = ""
        Next
    End Sub
unfortunately this code erases all text not only textboxes so i tried this

Code:
    Private Sub Clear_Fields(ByVal CForm As Form)
        Dim CControl As System.Windows.Forms.Control
        Dim tb As System.Windows.Forms.TextBox
        For Each CControl In CForm.Controls
            If CControl.GetType Is tb.GetType Then
            CControl.Text = ""
            End If
        Next
    End Sub
this doesn't do anything unfortunately...

so then i tried this

Code:
    Private Sub Clear_Fields(ByVal CForm As Form)
        Dim tb As System.Windows.Forms.TextBox
        For Each tb In CForm.Controls
            tb.Text = ""
        Next
    End Sub
it didnt work as well so im out of ideas right now... any suggestions?
thanks.