cancel
Showing results for 
Search instead for 
Did you mean: 

Clearing the fields in the form in vb.net

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi,

Thanks for your kind reply,

i am getting error for Findcontrol , as it saying " FINDCONTROL IS NOT A MEMBER ".

Is there any namespace to be added to use findcontrol.

Thanks,

Y.

Answers (1)

Answers (1)

Former Member
0 Kudos

Very helpful to me