Clear all textboxes on a form at run-time

By | 2002-06-01

handy code for clearing all text box controls at run-time
so you don’t have to bother doing it at design time.
http://137.56.41.168:2080/VisualBasicSource/vbworkingwithtextbox.txt

Original Author: Found on the World Wide Web

Code

'make a new form; put some textboxen on it with some text in it
'make a commandbutton
'put the next code under the Command_Click event
   Dim Control
   For Each Control In Form1.Controls
     If TypeOf Control Is TextBox Then Control.Text = ""
   Next Control

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.