In VB6 I would do something like:
But this doesn't work.Code:Private Sub DoColors() Dim FormControl As Control For Each FormControl In Me.Controls CType(FormControl, WebControl).BackColor = (New Color).FromArgb(RGB(CType(Rnd() * 255, Integer), CType(Rnd() * 255, Integer), CType(Rnd() * 255, Integer))) Next End Sub
It errors on:
Saying it's an invalid typecastCode:CType(FormControl, WebControl).BackColor
Woka



Reply With Quote