OK, so I am having some trouble with writing to a text file, retrieving values from My.Settings. The code is below. The problem is that when I check the text file, it only has the first line (which is just a simple string in the code).
Dim settingsfile As String = Directory.GetCurrentDirectory & "\RapidSend_Settings.txt"
Dim objWriter As New System.IO.StreamWriter(settingsfile, False)
objWriter.WriteLine("This is the introductory line")
For Each strEmail As String In My.Settings.User_Emails 'Specialized.StringCollection
objWriter.WriteLine("Email " & strEmail)
Next
For Each strHostName As String In My.Settings.User_HostName ' Specialized.StringCollection
objWriter.WriteLine("Host " & strHostName)
Next
objWriter.WriteLine("End Of File")
objWriter.Close()
This is what the text file looks like after the code:
This is the introductory line
End Of File
My question is does anyone know what the problem is, or is there another way to do this. BTW, all the My.Settings are Specialized.StringCollection, so they contain lots of strings.