Hi there folks! Since winter is on the way, I wanted to add some snow to an app for the students. Get them in the Christmas spirit! So, I found a snippet of code on the net..
VB Code:
Dim x(150), y(150), ptimer Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 27 Then Unload Me End If End Sub Private Sub Form_Load() Form1.Width = 15360 For Var = 0 To 150 x(Var) = Form1.ScaleHeight * Rnd y(Var) = Form1.ScaleWidth * Rnd Form1.Circle (x(Var), y(Var)), 10, QBColor(15) Next Var End Sub Private Sub Snow_Timer() If Timer < ptimer + 0.01 Then Exit Sub Form1.Cls For Var = 0 To 150 'x(Var) = Form1.ScaleHeight * Rnd 'y(Var) = Form1.ScaleWidth * Rnd s = Int(Rnd * 50) x(Var) = Val(x(Var) + s) r = Int(Rnd * 50) y(Var) = Val(y(Var) + r) If x(Var) > Form1.ScaleHeight Then x(Var) = -1 End If If y(Var) > Form1.ScaleWidth Then y(Var) = -1 End If Form1.Circle (x(Var), y(Var)), 15, QBColor(15) ptimer = Timer Next End Sub
The problem is now that I integrated it, it is saying I need to define "var", but it didn't need to be in the example code by itself?
Where did I go wrong?
Thanks!!




Reply With Quote