|
-
Feb 14th, 2000, 05:31 AM
#1
Thread Starter
Hyperactive Member
Hi,
I've got a bunch of textboxes and commandbuttons and it seems to me that there should be a way to iterate through them to change their backcolor.I want them to all keep their existing names and indexs though.
Anyway to do this?
Thanks
joey o.
-
Feb 14th, 2000, 05:34 AM
#2
Addicted Member
You could loop through the controls collection and then depending on the type of control you could then change the backcolor property or whatever other property you wanted to change.
-
Feb 14th, 2000, 05:44 AM
#3
Thread Starter
Hyperactive Member
I want to know how to use the controls collection but only choose some of the textboxes.Can I define them as a collection somehow?
-
Feb 14th, 2000, 06:00 AM
#4
Lively Member
Try this
for i = 0 to form.controls
if typeof form.controls(i) is Text then
' do whatever
esle if typeof form.control(i) is Commandbutton then
' do whatever
endif
next i
-
Feb 14th, 2000, 06:52 AM
#5
let me pretty up (and correct) svskumar's example
Code:
Dim intControl As Integer
For intControl = 0 To Me.Controls.Count - 1
If TypeOf Me.Controls(intControl) Is TextBox Then
MsgBox "textbox"
ElseIf TypeOf Me.Controls(intControl) Is CommandButton Then
' do whatever
End If
Next intControl
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|