It may be of interest to read the response I got regarding comparing control types and the very small related thread.
I think this is a good example of using the response from variable.gettype
but in summary, the example corrected code is something like:-
For Each ctrl As Control In Me.Controls
If TypeOf ctrl Is System.Windows.Forms.Button Then
Console.WriteLine("test " & ctrl.GetType.ToString)
ctrl.BackColor = Color.FromName("red")
End If
Next
John T Barton
A single picture (or bit of code) is worth a thousand words