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.
unfortunately this code erases all text not only textboxes so i tried thisCode: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
this doesn't do anything unfortunately...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
so then i tried this
it didnt work as well so im out of ideas right now... any suggestions?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
thanks.




Reply With Quote