L
locutus
Guest
Hi
I have just started using vb and the .net enviroment and I am going through my teach yourself book . I decided to have a break and create a little application to practise some of the techniques I had learned.
I am trying to open a text file and loop through and read each line of the file into a holder of some type ( will prob use an array for the sake of using them in my example )
heres what I have so far
dim fsout as system.io.filestream
dim filename as string
dim oreader as system.io.streamreader
dim scontents as string
dim bexists as boolean
filename = "c:\login.txt"
bexists = system.io.file.exists(filename)
try
open the file
fsout = new system.io.filestream(filename,system.io.filemode.openorcreate,system.io.fileaccess.read)
oreader = new system.io.streamreader(fsout)
think I need a while in here to loop
scontents = oreader.readline
this is what I have so far , all I want to do is loop through to the end of the file and be able to assign each loop through to a holder of some type , but this new approach in .net is very confusing and I am struggling to get my head around it.
Would anyone be able to help with this small learning example of mine . If you supply the code to help could you try and explain what is going on also with the code
Many thx for your time
locutus
I have just started using vb and the .net enviroment and I am going through my teach yourself book . I decided to have a break and create a little application to practise some of the techniques I had learned.
I am trying to open a text file and loop through and read each line of the file into a holder of some type ( will prob use an array for the sake of using them in my example )
heres what I have so far
dim fsout as system.io.filestream
dim filename as string
dim oreader as system.io.streamreader
dim scontents as string
dim bexists as boolean
filename = "c:\login.txt"
bexists = system.io.file.exists(filename)
try
open the file
fsout = new system.io.filestream(filename,system.io.filemode.openorcreate,system.io.fileaccess.read)
oreader = new system.io.streamreader(fsout)
think I need a while in here to loop
scontents = oreader.readline
this is what I have so far , all I want to do is loop through to the end of the file and be able to assign each loop through to a holder of some type , but this new approach in .net is very confusing and I am struggling to get my head around it.
Would anyone be able to help with this small learning example of mine . If you supply the code to help could you try and explain what is going on also with the code
Many thx for your time
locutus