Reset all types controls in panel

S

Sheldon

Hello -

I need to set a bunch of controls in a panel to a value of blank (e.g.
combo, text, datetimepicker). There are many of each. I need code to loop
through and set all combos to blank; loop through and set all textboxes to
blank and loop through all datetimepickers and set them to today's date?

Any help is appreciated!
 
A

Armin Zingler

Sheldon said:
Hello -

I need to set a bunch of controls in a panel to a value of blank (e.g.
combo, text, datetimepicker). There are many of each. I need code
to loop through and set all combos to blank; loop through and set all
textboxes to blank and loop through all datetimepickers and set them
to today's date?

Any help is appreciated!

for each c in panel1.controls
if typeof c is combobox then
c.text = ""
elseif typeof c is datetimepicker then
with directcast(c, datetimepicker)
.property = value
end with
'...
end if
next

With a property like "Text", you can handle several controls in one go
because every control has this property.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top