|
-
May 24th, 2013, 01:49 PM
#1
Thread Starter
Hyperactive Member
[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
-
May 24th, 2013, 01:50 PM
#2
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.
Last edited by dday9; May 24th, 2013 at 01:55 PM.
-
May 24th, 2013, 01:52 PM
#3
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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 24th, 2013, 02:04 PM
#4
Re: After for/each display messagebox
I agree with that solution. Using LINQ for this would be overkill.
My usual boring signature: Nothing
 
-
May 24th, 2013, 02:10 PM
#5
Thread Starter
Hyperactive Member
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
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
|