[RESOLVED] After for/each display messagebox
Hey Guys,
I'm using this piece of code:
Code:
'// LOAD THE URLS
For Each URLline As String In formMassURLs.txtBoxMass.Text.Split(Environment.NewLine.ToCharArray, System.StringSplitOptions.RemoveEmptyEntries)
'// SEND REQUEST
Dim request As WebRequest = WebRequest.Create("http://api.site.com/get_backlinks.php?target=" & Trim(URLline) & "&count=" & numericController.Text & "&mode=domain&output=xml&AhrefsKey=" & Trim(txtBoxAhrefsKey.Text))
'// GET THE RESPONSE
Dim response As WebResponse = request.GetResponse()
'// THE DATASTREAM RETURNED BY THE REQUEST
Dim dataStream As Stream = response.GetResponseStream()
'// OPEN THE RESPONSE IN A STREAMREADER
Dim reader As New StreamReader(dataStream)
'// READ THE CONTENT TO THE END
Dim responseFromServer As String = reader.ReadToEnd()
'// RETRIEVE THE URL .XML
Dim XMLdoc As New System.Xml.XmlDocument
XMLdoc.Load(New StringReader(responseFromServer))
Dim list = XMLdoc.GetElementsByTagName("UrlFrom")
For Each item As System.Xml.XmlElement In list
listBoxMain.Items.Add(item.InnerText)
Next
'// CLEANUP
reader.Close()
response.Close()
Next
To loop through a multi text box, everything works as it should, the only part im having trouble with is when its finished to display a message box to say the task is complete, is there a way to say "after the last loop display the task complete message"
cheers for any info guys
Graham
Re: After for/each display messagebox
Call a messagebox to show after the next and before the clean up.
Edit -
Alternatively you could use:
Code:
If item Is list.Last Then
'Last iteration in list
End If
if you're able to use LINQ.
Re: After for/each display messagebox
Huh? You just put the command in the line immediately after Next. When the loop completes it's the next thing to execute.
Re: After for/each display messagebox
I agree with that solution. Using LINQ for this would be overkill.
Re: After for/each display messagebox
Hey Guys,
Ah geez thanks guys, i was over thinking it lol putting the command after the next did the trick :)
cheers guys!
Graham