[Help]Random Color Background[Solved]
Ok guys i have a timer set to 1000 intervals. and i want my background of form1 to change every 5 mili sec.
here is my code so far. how do i have it change to next color by itself after 5 mili secs
[php]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Timer1.Enabled = True
Me.BackColor = Color.DarkBlue
Me.BackColor = Color.Black
End Sub
End Class[/php]
Or what about this. How would i finish
[php]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Color = Me.BackColor
Select Case Color
Me.BackColor = Color.DarkBlue
Me.BackColor = Color.Black
End Select
End Sub
End Class[/php]
Does for me. I think it just passes too quickly to see well enough. Better at 10 milliseconds or a delay of 100 instead of 50.
copy and paste in your exact code from vb.
nig ga same here. you code?
Set timer to change at a specific interval
[php]
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim i As Integer
i = Rnd() * 3 + 1
Select Case i
Case 1
Me.BackColor = Color.Black
Case 2
Me.BackColor = Color.DarkBlue
Case 3
'yada yada
End Select
End Sub
[/php]
Always set I = to rnd * the number of cases you will have
haha, that works too.
have you guys picked a new Ca min?
i really want to join the new fag agency
hey shark try out this
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.BackColor = Color.Black
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.BackColor = Color.Black
Me.Refresh()
System.Threading.Thread.Sleep(250)
Me.Refresh()
System.Threading.Thread.Sleep(250)
Me.BackColor = Color.Red
Me.Refresh()
System.Threading.Thread.Sleep(250)
Me.BackColor = Color.Yellow
End Sub
End Class
Hopefully I can remember that for next time!
Off topic slightly:
To zman: Is that all it is or does the project have more?