Arachnid13
May 10th, 2006, 02:10 PM
x = 0 'initial value
Do
x = x + 1
Select Case x
Case 2
'what to do when x is 2
Case 10
'what to do when x is 10
Case 500
'what to do when x is 500
End Select
DoEvents
Loop
brad jones
May 10th, 2006, 03:22 PM
Don't use tags within your code. The (Indent) tag is messing up the color coding. Use spaces is my recommendation.
Brad!
Jacob Roman
May 10th, 2006, 06:22 PM
This is what I get when I copy and paste my code straight from VB. Seems like it's missing tabs or newline characters, cause it's suppose to be perfectly even:
Option Explicit
Public Function Calculate_Angle(X1 As Single, Y1 As Single, X2 As Single, Y2 As Single) As Single
Const PI As Single = 3.141592654
Dim DX As Single, DY As Single
Dim Angle As Single
DX = X2 - X1
DY = Y2 - Y1
Angle = 0
If DX = 0 Then
If DY = 0 Then
Angle = 0
ElseIf DY > 0 Then
Angle = PI / 2
Else
Angle = PI * 3 / 2
End If
ElseIf DY = 0 Then
If DX > 0 Then
Angle = 0
Else
Angle = PI
End If
Else
If DX < 0 Then
Angle = Atn(DY / DX) + PI
ElseIf DY < 0 Then
Angle = Atn(DY / DX) + (2 * PI)
Else
Angle = Atn(DY / DX)
End If
End If
Angle = Angle * 180 / PI
Calculate_Angle = Angle
End Function
Private Sub Form_Activate()
AutoRedraw = True
ScaleMode = 3
BackColor = RGB(0, 0, 0)
Circle (Me.ScaleWidth / 2, Me.ScaleHeight / 2), 50, RGB(0, 255, 0)
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Angle As Single
Angle = Calculate_Angle(Me.ScaleWidth / 2, Me.ScaleHeight / 2, X, Y)
Me.Caption = Angle
End Sub
penagate
May 11th, 2006, 03:48 AM
If you indent blank lines (like VB/most IDEs do by default) then that sometimes gets carried over onto the next line. You need to remove the unnecessary spaces.
Jacob Roman
May 11th, 2006, 11:26 AM
Apparently they fixed the problem cause it looks even now. :p