|
-
Oct 27th, 2012, 12:18 AM
#3
Thread Starter
New Member
Re: I need some help with loop and Streamreader
That's the problem. I know what "Loop" does with numbers. But I'm not sure how to use to to read lines using streamReader.
So far, this is what I was trying to write for my code. But I'm not even sure if themathbutton code makes sense.
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
OpenF.InitialDirectory = "C:/"
OpenF.FileName = "Open A File..."
OpenF.Filter = "ONLY Text Files (*.txt. | *.txt"
OpenF.ShowDialog()
End Sub
Private Sub btnMath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMath.Click
Dim myfile As System.IO.StreamReader
myfile = File.OpenText(myfilename)
Dim math As Integer
Do While myfile.Peek <> -1
myfile.ReadLine()
myfile.ReadLine()
Loop
myfile.Close()
Me.txtBox = Val(myfile.ReadLine)
End Sub
Basically, there are 3 lines repeating.
Math
What is 3*3?
9
Im trying to figure out a way to show the 2nd line on a textbox.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|