Hi everyone.
I'm trying to pass a list of string values through a procedure that will remove the values of the strings from a text file. This procedure is in a seperate class and is called by a module using the command line.
the code I have for the proc:
---Begin---
Public Sub RemoveFile(ByVal RemovalList() As String)
Dim FileInList As String
Dim IsSameFile As Integer
Dim TempFileList As New ArrayList()
Dim FileToRemove As String
FileInList = FileStreamReader.ReadLine()
For Each FileToRemove In RemovalList
While Not FileInList Is Nothing
IsSameFile = FileToRemove.CompareTo(FileInList)
If IsSameFile <> 0 Then
TempFileList.Add(FileInList)
FileInList = FileStreamReader.ReadLine()
Else
LogEntry.AddEntry("The File " & FileInList & " was removed ")
FileInList = FileStreamReader.ReadLine()
End If
End While
Next FileToRemove
...and some other stuff to recreate
--End--
I'm trying this in the module
myclass.removefile("this.txt", "that.txt")
no soup. No matter how many vales, I receive a ("Value of Type String cannot be converted to a 1-dimensional array of String)
I understand the error - but can't think of another way to get this functionality.
I've tried using collections, arraylists, and the like - still no luck. I'm guessing it's a simple problem that I'll see after many a beers. But, if any of you have an idea - I'd be much obliged.
inzo
I'm trying to pass a list of string values through a procedure that will remove the values of the strings from a text file. This procedure is in a seperate class and is called by a module using the command line.
the code I have for the proc:
---Begin---
Public Sub RemoveFile(ByVal RemovalList() As String)
Dim FileInList As String
Dim IsSameFile As Integer
Dim TempFileList As New ArrayList()
Dim FileToRemove As String
FileInList = FileStreamReader.ReadLine()
For Each FileToRemove In RemovalList
While Not FileInList Is Nothing
IsSameFile = FileToRemove.CompareTo(FileInList)
If IsSameFile <> 0 Then
TempFileList.Add(FileInList)
FileInList = FileStreamReader.ReadLine()
Else
LogEntry.AddEntry("The File " & FileInList & " was removed ")
FileInList = FileStreamReader.ReadLine()
End If
End While
Next FileToRemove
...and some other stuff to recreate
--End--
I'm trying this in the module
myclass.removefile("this.txt", "that.txt")
no soup. No matter how many vales, I receive a ("Value of Type String cannot be converted to a 1-dimensional array of String)
I understand the error - but can't think of another way to get this functionality.
I've tried using collections, arraylists, and the like - still no luck. I'm guessing it's a simple problem that I'll see after many a beers. But, if any of you have an idea - I'd be much obliged.
inzo