Clear all text boxes 
Author Message
 Clear all text boxes

I know there is a control to clear all text box controls on a form in one
step,
I just cannot remember it.
Can anyone help, please?

Dave



Mon, 05 Sep 2005 10:39:08 GMT  
 Clear all text boxes

Quote:
>I know there is a control to clear all text box controls on a form in one
>step,
>I just cannot remember it.
>Can anyone help, please?

What control ?

private sub CleanTextBoes( f as form)
dim c as control
for each c in f.controls
        if typeof c is TextBox Then
                c.text = ""
        endif
next
end sub

--

Regards, Frank



Mon, 05 Sep 2005 12:55:32 GMT  
 Clear all text boxes


Quote:

>>I know there is a control to clear all text box controls on a form in one
>>step,
>>I just cannot remember it.
>>Can anyone help, please?

>What control ?

>private sub CleanTextBoes( f as form)
>dim c as control
>for each c in f.controls
>    if typeof c is TextBox Then
>            c.text = ""
>    endif
>next
>end sub

ps:
Make that Public Sub and put it in a module.

--

Regards, Frank



Mon, 05 Sep 2005 12:56:33 GMT  
 Clear all text boxes
Quote:


>>I know there is a control to clear all text box controls on a form in one
>>step,
>>I just cannot remember it.
>>Can anyone help, please?

> What control ?

> private sub CleanTextBoes( f as form)
> dim c as control
> for each c in f.controls
>    if typeof c is TextBox Then
>            c.text = ""
>    endif
> next
> end sub

will the following code do the same, will it work?

Dim c as textbox
For each c in f.controls
        c.text=""
next



Mon, 05 Sep 2005 22:08:20 GMT  
 Clear all text boxes

Quote:


> >>I know there is a control to clear all text box controls on a form
in one
> >>step,
> >>I just cannot remember it.
> >>Can anyone help, please?

> > What control ?

> > private sub CleanTextBoes( f as form)
> > dim c as control
> > for each c in f.controls
> > if typeof c is TextBox Then
> > c.text = ""
> > endif
> > next
> > end sub

> will the following code do the same, will it work?

> Dim c as textbox
> For each c in f.controls
> c.text=""
> next

No! Just because you Dim 'c' as a TextBox does not mean the For Each
statement will only seek out TextBox'es from among the various controls
in the Controls collection. For Each grabs each item in the Controls
collection one-at-a-time. You'll get errors if an individual control is
not a TextBox (it won't "fit" into the 'c' variable).

Rick - MVP



Tue, 06 Sep 2005 02:02:43 GMT  
 Clear all text boxes
correction: command, not control...but there is none...the cod for a module
will work great...thank you!


Quote:
> I know there is a control to clear all text box controls on a form in one
> step,
> I just cannot remember it.
> Can anyone help, please?

> Dave



Tue, 06 Sep 2005 12:16:58 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Clearing a text box after submitting a from

2. Clearing DBCombo Text Box

3. How to clear a text box?

4. Clear the text boxes

5. Clearing /Resetting Text Boxes

6. Clear All Text Boxes

7. Clear a Text Box

8. How do I clear a text box

9. newbie ?- how can I clear all text box text with command button?

10. How to clear a text box which is part of an array?

11. Clearing text from text box

12. clearing text boxes after adding records

 

 
Powered by phpBB® Forum Software