CodeItBetter Programming Another VB Programming Blog

How to clear the contents of all the items in an array of TextBox controls

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
'Controls - How to clear the contents of all the items in an array of TextBox controls
For I = txtFields.LBound To txtFields.UBound
    txtFields(I).Text = ""
Next
 
'A better way to loop over all the items of a control array is using the For Each statement:

Dim txt As TextBox
For Each txt In txtFields
    txt.Text = ""
Next
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.