NoxiousOogle
New member
- Joined
- Aug 20, 2003
- Messages
- 4
Hi Guys,
Im a noob at VB.Net and also this is my first post here, so I hope its not too stupid
Im trying to access a text file, to read the data and put the data into various text boxes. I found the following code in the help section:
Dim sr As StreamReader
Open the file to read.
Sr = File.OpenText("c:\MyFile.txt")
Read each line in the file.
When the end of the file is reached, return the value "-1".
Dim x As String
While sr.Peek <> -1
x = sr.ReadLine()
Console.WriteLine(x)
End While
Tell user the operation is over and close the file.
Console.WriteLine("The end of the stream has been reached.")
sr.Close()
So I figured I would copy and paste this into my code, and then modify it to suit my needs. However, the word "Streamreader" is underlined, meaning an error of some type. When I hover my mouse on the word, it says "Type StreamReader is not defined". Isnt this a keyword, and shouldnt have to be declared like a variable?
Also, the word "File" in the third line is underlined too. Same error message.
Help! Thanks.
Im a noob at VB.Net and also this is my first post here, so I hope its not too stupid
Im trying to access a text file, to read the data and put the data into various text boxes. I found the following code in the help section:
Dim sr As StreamReader
Open the file to read.
Sr = File.OpenText("c:\MyFile.txt")
Read each line in the file.
When the end of the file is reached, return the value "-1".
Dim x As String
While sr.Peek <> -1
x = sr.ReadLine()
Console.WriteLine(x)
End While
Tell user the operation is over and close the file.
Console.WriteLine("The end of the stream has been reached.")
sr.Close()
So I figured I would copy and paste this into my code, and then modify it to suit my needs. However, the word "Streamreader" is underlined, meaning an error of some type. When I hover my mouse on the word, it says "Type StreamReader is not defined". Isnt this a keyword, and shouldnt have to be declared like a variable?
Also, the word "File" in the third line is underlined too. Same error message.
Help! Thanks.