4
Reply

loop logic problems

peasncarrots

peasncarrots

Aug 23 2004 7:28 PM
2k
Hello, I have hit a wall on this project and am looking for some guidance. I am setting up a sub to loop through a text based file and return various figures. I ahve managed to get the number of characters to return with this: Dim i As StreamReader = New StreamReader(strFile) strFile = i.ReadToEnd Dim intChar As Integer = 0 For j = 0 To strFile.Length - 1 intChar += 1 Next j NumberOfCharacters = intChar j = 0 Then when I try to get a value returned for the number of linefeeds in the file, I get the same number? Any ideas? my code: Dim chrFeed As String = ControlChars.Lf Dim intPara As Integer = 0 'This will loop through and count everytime the return(enter) key was struck. For Each chrFeed In strFile intPara += 1 Next NumberOfParagraphs = intPara Thanks for your help

Answers (4)