Based on the error message, apparently your TextBox2.Text.Length is less than 4 which resulted in negative value from their subtraction. You can't have a negative length for the second argument of Substring() method.
Look like you are trying to remove the dot extension from your file path, if so, you should first ascertain that that dot extension exists, e.g.
Dim value As String = "peterleow/haha.html"
If value.LastIndexOf("."c) <> -1 Then
Console.WriteLine(value.Substring(0, value.LastIndexOf("."c)))
End If
Learn
LastIndexOf[
^]