My Form Looks like this
Click Here
I have edited the code I got from MSN, I enter Numbers in the textboxes and click "Draw Line" button.
If the user wants to enter new numbers in the textbox, and click the button again, how can that line be deleted before a new one is drawn?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim canvas As New ShapeContainer
Dim theLine As New LineShape, Var1, Var2
Dim x, y
var1 = Val(TxtHgt.Text)
Var2 = Val(TxtLgth.Text)
x = Var2 * 2
y = Var1 * 2
' Set the form as the parent of the ShapeContainer.
canvas.Parent = Me
' Set the ShapeContainer as the parent of the LineShape.
theLine.Parent = canvas
' Set the starting and ending coordinates for the line.
theLine.StartPoint = New System.Drawing.Point(0, 0)
theLine.EndPoint = New System.Drawing.Point(x, y)
End Sub
Thanks,