J. Scott Elblein
Well-known member
Hi
I am trying to write the contents of a hashtable to a text file. I am getting an InvalidCastException on the For Each itm line. (when casting from a number, the value must be a number less than infinity)
Here is the code I am trying, can anyone help?
Thanks!
I am trying to write the contents of a hashtable to a text file. I am getting an InvalidCastException on the For Each itm line. (when casting from a number, the value must be a number less than infinity)
Here is the code I am trying, can anyone help?
VB.NET:
Using sw As IO.StreamWriter = New IO.StreamWriter("C:\Friends.txt", True)
Dim itm As KeyValuePair(Of String, String)
' Loop through the hashtable adding each item to the text file
For Each itm In hFriends
sw.WriteLine(itm.Key & "§" & itm.Value)
Next
sw.Flush()
sw.Close()
End Using
Thanks!