Call txt() Dim canvas As New Bitmap(PictureBox1.Width, PictureBox1.Height) Using g As Graphics = Graphics.FromImage(canvas) Dim maxIndex As Integer = zahyo.Length - 1 For i = 0 To maxIndex - 1 For j = i + 1 To maxIndex g.DrawLine(Pens.Black, zahyo(i), zahyo(j)) Next Next End Using Dim oldImage = PictureBox1.Image PictureBox1.Image = canvas If oldImage IsNot Nothing Then oldImage.Dispse() End If