tmighty tmighty - 3 years ago 123
Vb.net Question

New and FromArgb in 1 line

I have these 2 lines to create a color:

Dim nCol As New Color
nCol = Color.FromArgb(200, 200, 200)


I was hoping I could simplify it by something like

Dim nCol As New Color = Color.FromArgb(200, 200, 200)


or

Dim nCol As Color.FromArgb(200, 200, 200)


but none of my attempts would compile.

Can this be done in a single statement and if yes, how?

Answer Source

Close .. But this should do it

Dim nCol As  Color = Color.FromArgb(200, 200, 200)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download