CLEARING ALL TXTBOXES ON A FORM IN ONE CALL

Untill now having a form with a lot off txtboxes on it , and user cancels input given,  I set all txtText.text  boxes  = "" 
Most off time not arrays , so loop is not usable, would there be a quick way to set all these txt-boxes to ""  in one
click
BIAPROAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bruintjeCommented:
Hello BIAPRO,

not sure what code you have but in vb you could do

Dim ctl As Control
   
  ' Clear all the TextBoxes on the form.
  For Each ctl In Controls
    If TypeOf ctl Is TextBox Then ctl.Text = ""
  Next ctl

source: http://www.vb-helper.com/howto_clear_textboxes.html

hope this helps a bit
bruintje
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
What are you programming in?  The above code is correct for VB and Access VBA (replace .Text with .Value for Access).
0
BIAPROAuthor Commented:
Ok bruintje  works for textboxes,  how to do for rich-textboxes???
0
bruintjeCommented:
think the same

Dim ctl As Control
   
  ' Clear all the TextBoxes on the form.
  For Each ctl In Controls
    If TypeOf ctl Is RichTextBox Then ctl.Text = ""
  Next ctl
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BIAPROAuthor Commented:
Thanks, saves a lot off code
Regards Jack
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.