Thursday, March 22, 2012

Textbox

How i can clear text from all textbox controls from page with loop

if typeof is textbox then me.textbox.text=""Use recursion to do this, this example would clear the text on the entire page


IterateControls(Me.Controls)

Private Sub IterateControls(ByVal cs As ControlCollection)
Dim c As Control
For Each c In cs
If TypeOf c Is TextBox Then
CType(c, TextBox).Text = String.Empty
End If
IterateControls(c.Controls)
Next
End Sub

0 comments:

Post a Comment