|
-
Jan 16th, 2000, 05:07 AM
#1
Thread Starter
Hyperactive Member
I have four TextBox arrays on a form. e.g. Text1(0) through (5), Text2(0) through (5), etc.
What's the best way to Clear these?
I'm currently using a For/Next loop but, being arrays, I'm wondering if something like Erase might work. I get an "Expected Array" error when trying to use Erase.
Thanks,
Al.
------------------
A computer is a tool, not a toy.
<A HREF="mailto:[email protected]
[email protected]">[email protected]
[email protected]</A>
-
Jan 16th, 2000, 02:29 PM
#2
Private Sub ClearTextBoxes()
Dim ctl as Control
For Each ctl in Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
End Sub
...that'll clear out every textbox on the active form regardless of it's name...
-
Jan 16th, 2000, 04:07 PM
#3
Lively Member
Just beware of the way listed above that you will clear out all text boxes on the form. Other wise it is fine.
If you're using this code on the same form ok, but if you use it in a module pass the form thru to the module and you can then use it in various places.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|