2,892 questions
Try specifying the full name: System.Windows.Forms.Button instead of Buttons. Or adjust the Imports directives.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi friends,
I have a VB routine to change the color of some buttons inside the flowLayoutPanel1 control.
It is giving error, stating that "Expression of type Control can never be of type VisualStyleElement.Button in line If TypeOf op1 Is Button Then.
I can't figure out the error.
Code:
For Each op1 As Control In flowLayoutPanel1.Controls
If TypeOf op1 Is Button Then
Dim butt As Button = DirectCast(op1, Button)
butt.BackColor = Color.PeachPuff ' Substitua pela cor desejada
End If
Next
Thank ou
Try specifying the full name: System.Windows.Forms.Button instead of Buttons. Or adjust the Imports directives.