I keep getting either a Infinite loop error or a invalidCastException for this function not sure why.
I am looking to create a function that can be used in Click events to change the color of the background.
Code:Function BackEndColors(ByVal strTheme As String) ''Checks to see if user selected ThemeColor'' ''CStr converts data table row 0 , item 0 to a string - inline for better performance strTheme = CStr(dtThemeColor.Rows(0).Item(0)) If Not (strTheme <> Nothing) Then ''if the user has a preference set in their user account information ''nested If'' ''makes color of background fit users preference'' If strTheme = "Default" Then pnlTitle.BackColor = Color.SteelBlue Me.BackColor = Color.FromArgb(122, 154, 186) lilRegister.LinkColor = Color.LightSteelBlue ElseIf strTheme = "Green" Then pnlTitle.BackColor = Color.DarkOliveGreen Me.BackColor = Color.OliveDrab lilRegister.LinkColor = Color.Navy ElseIf strTheme = "Blue" Then pnlTitle.BackColor = Color.MidnightBlue Me.BackColor = Color.DarkSlateBlue lilRegister.LinkColor = Color.PowderBlue ElseIf strTheme = "LightBlue" Then pnlTitle.BackColor = Color.FromArgb(0, 105, 183) Me.BackColor = Color.FromArgb(69, 132, 207) lilRegister.LinkColor = Color.Navy End If Else ''If user didn't select color'' ''Default Theme'' BackEndColors("default") ''Default ThemeColor'' strTheme = "" End If ''null pointer - Void Function'' ''needed for NullPointerException'' Return Nothing End Function




Reply With Quote
