Public Class Form1
    Function length(ByVal x As String) As Integer
        Dim pace As Integer
        Do Until x = ""
            x = x.Substring(1)
            pace += 1
        Loop
        Return pace
    End Function
    Function Cut(ByVal x As String) As String
        If x.IndexOf(TextBox2.Text) = -1 Then
            Return x
        Else
            Dim line As String
            If x.IndexOf(TextBox2.Text) = 0 Then

                x = x.Substring(length(TextBox2.Text))

                line = x
            Else : line = x.Substring(0, x.IndexOf(TextBox2.Text))
                x = x.Substring(length(TextBox2.Text) + x.IndexOf(TextBox2.Text))
                line = line & x
        End If
            Return line
        End If
    End Function

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = "" : TextBox2.Text = "" : TextBox3.Text = ""
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox2.Text = "" Then
        Else
            Dim x As String = TextBox1.Text
            Do Until x.IndexOf(TextBox2.Text) = -1
                x = Cut(x)
            Loop
            TextBox3.Text = x
        End If

    End Sub

    
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If TextBox3.Text = "" Then
        Else
            TextBox1.Text = TextBox3.Text
            TextBox2.Text = ""
        End If
    End Sub
End Class
