Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Logic error in Do While loop
 

Logic error in Do While loop

I am making a simple comic aggregator, and have gotten the basic parts down, but when I am getting the data from the site, I am only reading two lines of HTML, even if I am reading from a saved site on my hard drive. Any help is appreciated.

Public Sub btnAggregate_Click(ByVal Sender As System.Object, ByVal e As System.EventArgs) _
Handles btnAggregate.Click

Dim strComicDir As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Dim strURL As String = "http://www.xkcd.com/"
Dim wcConnection As New WebClient()
Dim Data As Stream = wcConnection.OpenRead(strURL)
Dim Reader As StreamReader = New StreamReader(Data)
Dim strData As String = Reader.ReadLine()

MsgBox(strData)

Do While strData.Length > 0

If strData.Contains("<h3>") Then MsgBox(strData)

strData = Reader.ReadLine()

Loop


ptbComic.Image = Image.FromFile("C:\Documents and Settings\B.Perry\Desktop\battle_room.png")

End Sub


BrandonPerry  Saturday, March 31, 2007 5:35 PM

Change your do while to:

Do While Not Reader.EndOfStream

Tall Dude  Saturday, March 31, 2007 9:42 PM

Change your do while to:

Do While Not Reader.EndOfStream

Tall Dude  Saturday, March 31, 2007 9:42 PM

You can use google to search for other answers

Custom Search

More Threads

• Read File and Write New Info to file
• how to copy dataTable value to dataset
• How to use font from resources
• Can the dtpicker be null without checkbox option
• how can i get the path of "Program Files" directory
• Me.activecontrols not working
• very nooby question
• Controversial Topic of Winsck and TCP/IP Connecting
• Totalling the hours of a column
• Cannot Access Properties of Global Object in a Derived Form