Having trouble with my code, I resort to writing the contents of my arrays to file, like this:-
Private Sub DumpArray (ByRef array_to_dump(,) As MyEnum, ByVal file_name As String)
Dim sw As StreamWriter = New StreamWriter(file_name)
For i As Integer = array_to_dump.GetLowerBound(0) To array_to_dump.GetUpperBound(0)
For j As Integer = array_to_dump.GetLowerBound(1) To array_to_dump.GetUpperBound(1)
If array_to_dump(i, j) = MyEnum.This Then
sw.Write("Fred")
Else
sw.Write("Bert")
End If
sw.Write(vbTab)
Next j
sw.WriteLine
Next i
sw.Flush
sw.Close
End Sub
This produces the output I expect; in the current case a file filled with "Fred", separated by tabs. However, if I change the business end of the code to this:-
If array_to_dump(i, j) = MyEnum.This Then
sw.Write("1")
Else
sw.Write("0")
End If
the file is filled with non-printing characters, that come out as little boxes in Notepad, rather than the rows of "0" separated by tabs that I was expecting. Any other pairs of single-character strings do the same.
While not a matter of pressing importance, I am idly curious as to why this should be. Does anyone know?