Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For Each Control.... 2

Status
Not open for further replies.

baileybelle

Technical User
Jul 22, 2002
10
US
I would like to clear the contents of each text box on a form using the 'For Each' command. what would the proper syntax be to accomplish this? Thanks in advance.
 
Try something like this...

For lnCnt = 1 To THISFORM.ControlCount
loObj = THISFORM.Controls[lnCnt]
IF loObj.BaseClass = "Textbox"
loObj.value = ""
loObj.refresh()
endif
Next

...it should be noted that if your form has other controls that contain textboxes such as pageframes you would need to dig down into those and find the textboxes as well...but you didn't specify that so I am just giving the short and sweet answer for right now Slighthaze = NULL
 
baileybelle

Here is a one-liner...

thisform.SetAll("value","","textbox")

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

Here is a one-liner...

thisform.SetAll("value","","textbox")


Darn it, why didn't I think of that! Argggghhhh!! Slighthaze = NULL
 
This is just a clear answer for this question
Why we all here?
I personally think that we learn from each other maybe more than we help each other.

This was a good one Mick, will done


Walid Magd
Engwam@Hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top