Private Sub Command1_Click()
Dim n, j, i, k, g, b As Integer
Dim D As Single
Dim v(), dok(), Shmeio(), X(), Y() As Variant
Dim GAB As Double, GAC As Double
Dim DXA As Double, DYA As Double
Dim DXB As Double, DYB As Double
Dim pi As Double
pi = 4 * Atn(1)
Form1.Cls
Open "c:\leon\coords.txt" For Input As 1
b = 0
While Not EOF(1)
b = b + 1
Line Input #1, g
Wend
n = b
Print n
Close #1

ReDim v(n - 2), dok(n - 2), Shmeio(n), X(n), Y(n)
Open "c:\leon\coords.txt" For Input As 2
j = 0
While Not EOF(2)
j = j + 1
Input #2, Shmeio(j), X(j), Y(j)
Wend
Close #2
For i = 1 To n - 2
DXB = X(i + 2) - X(i)
DYB = Y(i + 2) - Y(i)
GAC = Atn(DXB / DYB)
DXA = X(i + 1) - X(i)
DYA = Y(i + 1) - Y(i)
GAB = Atn(DXA / DYA)
v(i) = Abs(GAC - GAB)
Print v(i)
Next i
D = InputBox("Ποια θα είναι η οριακή γωνία; (σε Grad) ")
Print D
Open "c:\leon\coords_telikes.txt" For Output As 3
Print #3, Shmeio(1); X(1); Y(1)
For k = 1 To n - 2
If v(k) > D Then
Print k + 1
Print #3, Shmeio(k + 1); X(k + 1); Y(k + 1)
Else
Print "THE POINT "; k + 1; " REJECTED"
End If
Next k
Print n
Print #3, Shmeio(n); X(n); Y(n)
Close #3

End Sub

--------------------------------------------------------------------------
I want to make a button tha draws the line with points (X,Y) of the primary file coords.txt and at the same time draws the line with the remaining points (X,Y) of the new file coords_telikes.txt