[Solved] String cannot be of zero length error [closed]


You need to check if the area contains a hyphen. Otherwise Row.Area.Substring(0, Row.Area.IndexOf("-") + 1) will return an empty string, and passing the empty string to Replace is what is causing the error.

So (and please excuse any invalid VB.Net)

If Row.Area.Contains("-") Then
    Dim area As String = Row.Area.Substring(0, Row.Area.IndexOf("-") + 1)
    Row.Area = Row.Area.Replace(area, "")
End If

0

solved String cannot be of zero length error [closed]