This morning is just not my morning. This seems pretty straight forward but for some reason I just can't get the syntax correct.
Here are the lines of code that I am having issue with:
I am getting "Object reference not set to an instance of an object." error on the line: _moveFiles(counter) = fileHold
Normally I would initialize a FileInfo variable using "New" but New cannot be used with an array which is why I tried creating a new FileInfo then making an element in the array equal to it.
How do I assign specific paths to my FileInfo array?
Here are the lines of code that I am having issue with:
VB.NET:
Private _moveFiles() As FileInfo
'Inside the subroutine the code follows
Dim counter As Integer
Dim pathHold As String
If IO.File.Exists(pathHold) Then
Dim fileHold As New FileInfo(pathHold)
_moveFiles(counter) = fileHold
End If
I am getting "Object reference not set to an instance of an object." error on the line: _moveFiles(counter) = fileHold
Normally I would initialize a FileInfo variable using "New" but New cannot be used with an array which is why I tried creating a new FileInfo then making an element in the array equal to it.
How do I assign specific paths to my FileInfo array?