Who can help me with the following

For Each Con As Control In GroupBox1.Controls
            If Con.GetType Is GetType(Button) Then
                Con.BackColor = SystemColors.Control
                Con.UseVisualStyleBackColor = True
            End If
        Next

Can someone help me to fix it with
Con.UseVisualStyleBackColor = True

or do i have to do the for all buttons separate
like Me.Button1.UseVisualStyleBackColor = True
Me.Button2.UseVisualStyleBackColor = True

i have 32 buttons in groupbox

thanks in advice John

UseVisualStyleBackColor is True by default. To set other properties for all buttons you could do, as an example

For Each btn As Button In GroupBox1.Controls.OfType(Of Button)()
    btn.BackColor = Color.Cyan
Next

You can't change the defaults like

Button.DefaultBackColor = Color.Cyan

because default properties are read-only.

Oke. Than i have to do for each button separate like

Me.Button1.UseVisualStyleBackColor = True

and that work it's only a lot typing.
thanks

You didn't read my answer. UseVisualStyleBackColor = True is the default. In any case, if you want to set the same base settings for a bunch of controls at design time, just select them all then set the properties. Or you can create one button with the properties you want, then copy/paste to get the rest.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.