Hello,
I am using the code below to add vb.Lines to my form.
My question is how do I delete the lines?
I tried me.Controls.Remove q_lines but that doesn't delete anymore then one line.
So if the user created 2 or even 10 lines how would I delete them?
Thank you and have a great!
Stilekid007
VB Code:
Private q_InDrawMode As Boolean Private q_ActivateDrawmode As Boolean Private q_Lines As Line Private Sub Command1_Click() q_ActivateDrawmode = True End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Static LineNumber As Long LineNumber = LineNumber + 1 If q_ActivateDrawmode = True Then 'create a new line and initialise it at the current mouse pointer Set q_Lines = Me.Controls.Add("VB.Line", "Line" & CStr(LineNumber), Form1) q_Lines.X1 = X q_Lines.X2 = X q_Lines.Y1 = Y q_Lines.Y2 = Y q_Lines.Visible = True q_InDrawMode = True End If End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If q_InDrawMode Then 'move the end point of the line q_Lines.X2 = X q_Lines.Y2 = Y End If End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) q_InDrawMode = False q_ActivateDrawmode = False End Sub




Reply With Quote