HI Everyone!
In this lesson we will consolidate code to prevent code reuse. Follow along as we demonstrate by doing the following and more:
Apply a color to a form command button, loop form controls, and save and get the color from registry
Part 3 of 7
As always If anyone wants to contribute to these posts with any tips or things to add I think it would be great.You could let us know:-How you do it (or better).-Your suggestions-Any screw up I said or did in the video.-Any extra tips about the subject.-Feedback~John
getting an error = Runtime Error '424' Object Required.
here is what I have where the error is showing:
Private Function getCol(i%) As Color Dim strCol$ Set getCol = New Color strCol = GetSetting(cMACRONAME, "Pref_" & VersionMajor, "col_" & i, col.ToString) If strCol = "" Then getCol.RGBAssign 204, 204, 204 Else getCol.StringAssign strCol End IfEnd Function
how would I color this part of a form? *see attached
this is the code in the button. The error 'Variable not defined' happens at PagGeneral.BackColor:
Private Sub cmdColorSelect_Click() Dim cols As New Color Dim i% i = 1 If cols.UserAssignEx Then 'saveCol cols, i cols.ConvertToRGB frmNumberPage.BackColor = RGB(cols.RGBRed, cols.RGBGreen, cols.RGBBlue) fraGeneral.BackColor = RGB(cols.RGBRed, cols.RGBGreen, cols.RGBBlue) pagGeneral.BackColor = RGB(cols.RGBRed, cols.RGBGreen, cols.RGBBlue) End IfEnd Sub