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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Properties collection of a Controls collection. Help

Status
Not open for further replies.

wadey

Programmer
Jun 6, 2006
54
GB
I'm trying to retrieve the properties collection of a control collection, and my code is giving me the "object doesnt support this property or method" error. Anyone know why ?

Dim objForm as Form
Dim objControl As Control
Dim objProperties As Property


For Each objControl In objForm.Controls
Debug.Print TypeName(objControl) & ": " & objControl.Name
For Each objProperties In objControl.Properties <-----ERRORS HERE
Debug.Print "Properties for " & objControl.Name & ": " & objProperties.Name
Next
Next
 
The error is telling the truth - VB6 controls do not have a Properties collection.
 
The properties for a control are referenced directly
e.g.
Code:
objControl.Text = "Big Bad Bill"
objControl.Left = 25
Debug.Print objControl.Value
Debug.Print objControl.Top
As strongm says, they are not contained in a collection.
 
However, if it is really VB6 controls for which you want to enumerate class properties, here's my example code for doing just that:

thread222-388942
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top