In my VB6.0 App I have a Public Sub 'Update_Form_Controls' that I call from each of the dozens of forms in the app. The purpose of the sub is to make sure that the fonts, foreground colors and various other attributtes are consistent for most of the controls on all of the forms in the app. We had several developers work on the forms and they didn't always adhere to the standards. This is a way to clean up without revising each non-standard control individually. I realize that I take a performance to invoke this on each form but it needs to be done.
Here is some of the Sub's code that I am using for labels:
Public Sub Update_Form_Controls(ByRef frm As Form)
Dim c As Control
For Each c In frm.Controls
controlType = Trim(UCase(TypeName(c)))
controlName = Trim(UCase(c.Name))
Select Case UCase(TypeName(c))
Case Is = "LABEL"
If UCase(Mid(c.Name, 1, 7)) = "LBLVLOW" Or _
UCase(Mid(c.Name, 1, 6)) = "LBLLOW" Or _
UCase(Mid(c.Name, 1, 8)) = "LBLVHIGH" Or _
UCase(Mid(c.Name, 1, 7)) = "LBLHIGH" Or _
UCase(Mid(c.Name, 1, 6)) = "LBLCDP" Or _
UCase(Mid(c.Name, 1, 13)) = "LBLDRAFTCOLOR" Or _
UCase(Mid(c.Name, 1, 11)) = "LBLRFRCOLOR" Or _
UCase(Mid(c.Name, 1, 13)) = "LBLERRORCOLOR" Or _
UCase(Mid(c.Name, 1, 11)) = "LBLCDPCOLOR" Or _
UCase(Mid(c.Name, 1, 11)) = "LBLTRANSFERCAPTION" Or _
UCase(Mid(c.Name, 1, 16)) = "LBLCOMPLETECOLOR" Then
c.BackStyle = 0
' certain labels should not be resized or font altered.
As you can see with lables, some of the the controls are execptions and I either don't want to alter the attributes or I want them to have their own unique attributes. In this example I am identifying the by their names. To reduce the number of contols on one of the forms I used a control array 'lblfrmDesc' for all of the 35 labels on the form. Within those 35 labels their are some that I want to handle uniquely. For example: lblfrmDesc(10) and lblfrmDesc(11) have attributes defined on them that I don't want to change. I want all of the other labels in the control array to have a tranparent background, but these should be opaque. I can't figure out how to reference a unique occurrence of a control array in the Public Sub that is used by all of the forms in the system. If the Sub were private and on the form in question, I would could refer to the controls as lblfrmDesc(10).backstyle but since it is public and I pass the form into it I don't have that option.
How do I reference lblfrmDesc(10).backstyle in my public subroutine? Gnerally how do I reference a specific element of a control array in my subroutine.