John Bartow
jbartow at earthlink.net
Tue Feb 18 12:12:00 CST 2003
OK in both cases I need to: find the result based on the frame's value find the name of the radio button contained in the frame with that value find the name of the associated label contained by that radio button change the fore color of it as desired So the difference between the two would be: Sub: I would have to call a sub for every control on every form and pass it the form and control name WithEvents Class: I would instantiate the class once when the app starts and it would "keep tabs" on which form and control is being used so and I would never have to include any additional code Is this correct? JB -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com]On Behalf Of Heenan, Lambert Sent: Tuesday, February 18, 2003 11:23 AM To: 'accessd at databaseadvisors.com' Subject: RE: [AccessD] need ideas Whether you use a class with WithEvents, or just a simple Sub that you call in the option group's On_Click event, here's an example of the basic logic that you could use to do the color changing... Sub formatOpGroup(opGrp As OptionGroup, sCaption As String) Dim c As Control For Each c In opGrp.Controls If TypeOf c Is Label Then If c.Caption = sCaption Then c.ForeColor = IIf(sCaption = "Yes", RGB(0, 255, 0), RGB(255, 0, 0)) Else c.ForeColor = RGB(0, 0, 0) End If End If Next c End Sub Lambert > -----Original Message----- > From: John Bartow [SMTP:jbartow at earthlink.net] > Sent: Tuesday, February 18, 2003 11:40 AM > To: AccessD > Subject: [AccessD] need ideas > > I'm involved in an app where the color of the associated label for radio > buttons in a frame should change once its selected. > > The frames are all the same and have radio buttons with "Yes" and "No" as > labels. They would like the NO to be red when selected and YES to be green > when selected. > > I was thinking of trying a class but this seems like it would be a bit > more > complicated than the text box background color changing class that we've > discussed before. > > Any ideas or suggestions? > > JB > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com