MaxDes101
asked on
Error: String Cannot Be Of Zero Length
I have a program that should copy files based on listbox selection. Due to the entire path being in listbox I was trying to strip the path out for another variable. My code is below.
What is causing the error:
String Cannot be of zero length. Parameter Name: OldValue
What is causing the error:
String Cannot be of zero length. Parameter Name: OldValue
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.ProgressBar1.Maximum = 6
Me.ProgressBar1.Minimum = 0
Me.ProgressBar1.Value = 0
Dim sourceRoot As String = SearchLocation.Text
Dim destinationRoot As String = Review.Text
Dim FilePath As String
Dim newfile As String
newfile = ListBox9.SelectedItem.ToString().Replace(SearchLocation.Text, Review.Text)
If System.IO.File.Exists(ListBox9.SelectedItem) Then System.IO.File.Copy(ListBox9.SelectedItem, newfile)
ProgressBar1.Value = +6
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER