dumdumsareyum
New member
- Joined
- Dec 9, 2008
- Messages
- 4
- Programming Experience
- 1-3
I have an embedded resource text file that I can access to read but cannot figure out how to alter the text file during runtime. Here is my code to read from the file:
Here is what I am trying to do to write to the file, basically just trying to substitute writing for reading, but it's not working:
Help please?
VB.NET:
Public Sub LoadTopScores()
'Load top scores
Try
Dim _textStreamReader As StreamReader
Dim _assembly As [Assembly]
Dim scores As String = "HighScores.txt"
_assembly = [Assembly].GetExecutingAssembly()
_textStreamReader = New StreamReader(_assembly.GetManifestResourceStream("WheelofFortune." + scores))
For intCount As Integer = 0 To 9
strTopPlayers(intCount) = _textStreamReader.ReadLine()
intTopScores(intCount) = CInt(_textStreamReader.ReadLine())
Next intCount
Catch ex As Exception
MessageBox.Show("Resource not found!")
End Try
Here is what I am trying to do to write to the file, basically just trying to substitute writing for reading, but it's not working:
VB.NET:
Try
Dim _assembly As [Assembly]
Dim scores As String = "HighScores.txt"
Dim _textStreamWriter As StreamWriter
_assembly = [Assembly].GetExecutingAssembly()
_textStreamWriter = New StreamWriter(_assembly.GetManifestResourceStream("WheelofFortune." + scores))
_textStreamWriter = File.CreateText(scores)
For intCount As Integer = 0 To 9
_textStreamWriter.WriteLine(strTopPlayers(intCount).ToString)
_textStreamWriter.WriteLine(intTopScores(intCount).ToString)
Next intCount
_textStreamWriter.Close()
Catch ex As Exception
MessageBox.Show("Resource not found!")
End Try
Help please?