Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Clearing the fields in the form in vb.net

Hi,

How to clear the test fields , to perform very faster way. I am using this clear() method as follows

Me.ocmpnyto.Value = ""

Me.ocontactto.Value = ""

Me.ophoneto.Value = ""

Me.ofaxto.Value = ""

is there any alternative .....

Thanks and Regards,

Y.

Edited by: Yughandar on Apr 12, 2010 5:47 PM

Former Member
Former Member replied

HI,

What u have tried is fine, but u could also try the following..

Dim frm As Control = Me.FindControl("Form1")
Dim ctl As Control

For Each ctl In frm.Controls
Dim tb As TextBox
If TypeOf ctl Is TextBox Then
tb = CType(ctl, TextBox)
tb.Text = String.Empty
End If
Next

Hope it helps,

Vasu Natari.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question