B
B
Hello,
I am trying to migrate a vb6 app to vb.net. In one piece
of the vb6 app I have a label where the label backcolor
changes every 5 seconds on a timer. So I created an array
of colors as follows and then run the array in the timer
event in vb6. Not working in vb.net. How would I do this
in vb.net?
vb6 code:
-----------------------------------------
Const ORANGISH As Long = &HC0C0FF
Const ORYEL As Long = &HC0E0FF
Const YELLOWISH As Long = &HC0FFFF
Const GREENISH As Long = &HC0FFC0
Const LIGHTBLUISH As Long = &HFFFFC0
Const PURPLISH As Long = &HFFC0C0
Const PINKISH As Long = &HFFC0FF
Const WHITE As Long = &HFFFFFF
Dim arrColors As Variant
Private Sub Form_Load()
arrColors = Array(ORANGISH, ORYEL, YELLOWISH, LIGHTBLUISH,
PURPLISH, PINKISH, WHITE)
End Sub
Private Sub Timer1_Timer()
Static i
lblRunning.BackColor = arrColors(i)
i = i + 1
If i > 5 Then i = 0
End Sub
------------------------------------------------------
Here is my vb.net conversion
-----------------------------------------
constants...
Dim arrColors() As Long = {ORANGISH, ORYEL, YELLOWISH,
GREENISH, LIGHTBLUISH, PURPLISH, PINKISH, WHITE}
Private Sub Timer1_Tick(...) Handles Timer1.Tick
Static i As Integer
lblRunning.BackColor = CType(arrColors(i),
System.Drawing.Color)
i += 1
End Sub
-------------------------------------------------
The error message for vb.net says that it cannot convert a
long (arrColors(i)) to System.Drawing.Color. So how could
I achieve the same functionality in the vb.net app as in
the vb6 app above?
Thanks
I am trying to migrate a vb6 app to vb.net. In one piece
of the vb6 app I have a label where the label backcolor
changes every 5 seconds on a timer. So I created an array
of colors as follows and then run the array in the timer
event in vb6. Not working in vb.net. How would I do this
in vb.net?
vb6 code:
-----------------------------------------
Const ORANGISH As Long = &HC0C0FF
Const ORYEL As Long = &HC0E0FF
Const YELLOWISH As Long = &HC0FFFF
Const GREENISH As Long = &HC0FFC0
Const LIGHTBLUISH As Long = &HFFFFC0
Const PURPLISH As Long = &HFFC0C0
Const PINKISH As Long = &HFFC0FF
Const WHITE As Long = &HFFFFFF
Dim arrColors As Variant
Private Sub Form_Load()
arrColors = Array(ORANGISH, ORYEL, YELLOWISH, LIGHTBLUISH,
PURPLISH, PINKISH, WHITE)
End Sub
Private Sub Timer1_Timer()
Static i
lblRunning.BackColor = arrColors(i)
i = i + 1
If i > 5 Then i = 0
End Sub
------------------------------------------------------
Here is my vb.net conversion
-----------------------------------------
constants...
Dim arrColors() As Long = {ORANGISH, ORYEL, YELLOWISH,
GREENISH, LIGHTBLUISH, PURPLISH, PINKISH, WHITE}
Private Sub Timer1_Tick(...) Handles Timer1.Tick
Static i As Integer
lblRunning.BackColor = CType(arrColors(i),
System.Drawing.Color)
i += 1
End Sub
-------------------------------------------------
The error message for vb.net says that it cannot convert a
long (arrColors(i)) to System.Drawing.Color. So how could
I achieve the same functionality in the vb.net app as in
the vb6 app above?
Thanks