Click here to Skip to main content
15,892,809 members

Comments by hemendrapadia (Top 10 by date)

hemendrapadia 29-Aug-20 1:59am View    
Sorry, forgot to thank you.
Thank you very much for your response.
hemendrapadia 28-Aug-20 12:26pm View    
But first one is working.
hemendrapadia 28-Aug-20 12:17pm View    
Yes i tried that recursive but it throws error.
My code is as below:

Sub ManageControlFocusColor(ByVal controls As ControlCollection)

For Each c As Control In controls

If c.HasChildren Then
ManageControlFocusColor(c.Controls) 'Throws error here
End If

If TypeOf c Is TextBox Then
If c Is ActiveControl Then
c.BackColor = Color.LightSteelBlue
Else
c.BackColor = Color.White
End If
End If
'
If TypeOf c Is Button Then
If c Is ActiveControl Then
c.BackColor = Color.LightSteelBlue
Else
c.BackColor = Button.DefaultBackColor
End If
End If
Next
End Sub
----------------------------
Error
----------------------------
System.InvalidCastException: '[A]ControlCollection cannot be cast to [B]ControlCollection. Type A originates from 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Type B originates from 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'.'
hemendrapadia 24-Jul-19 1:09am View    
All the DLLs related to Crystal report, I think like Hanumanji(don't know sanjivani, then take whole mountain) i don't know which dlls,so all dlls.
hemendrapadia 10-Jul-15 13:13pm View    
I will take this solution as last option, i m thinking other way without creating controls. i have done it in VB6.0 but forget the code, and lost my code in damaged harddisk. Anyway thank you very much for your support.