How can i do to clear all the textbox using controls?

  • Thread starter Ricardo Corsi P. Cesar
  • Start date
R

Ricardo Corsi P. Cesar

I have many textbox in my webform, but i want clear all of them with on
single step.

Someone have the code ?



Thks
 
M

mart

This sample code should do what you're looking for:

Sub ClearTextBoxes()
Dim myForm As Control = Page.FindControl("form1")
Dim ctl As Control
For Each ctl In myForm.Controls
If ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox")
Then
CType(ctl, TextBox).Text = ""
End If
Next ctl
End Sub


Hope this helps,
Chris Moore [MSFT]


--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top