Click here to Skip to main content
15,915,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim req As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("www.synonym.com/synonyms/house/")
        Dim res As System.Net.HttpWebResponse = req.GetResponse
        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(res.GetResponseStream)
        MessageBox.Show(sr.ReadToEnd)
    End Sub


Basically I want to eventually just filter out the synonyms for the word HOUSE in a textbox or messagebox but can't seem to get any info to flow...sorry I'm such a noob
Posted
Comments
Sergey Alexandrovich Kryukov 1-May-12 22:21pm    
First of all, what it supposed to mean: "return... to a messagebox"? Now, what's the problem? Does the above code work?
--SA

1 solution

That's still a long way to go:
- store sr.ReadToEnd in a string variable (that's the source code of the page),
- then set up a Regex for getting the part where the results are shown (they look like <div class="Accent Sense">Sense 1:</div>house<br /><span class="equals">accommodate, hold, admit</span>
- get all matches for that regex (may be more than one)
- then split the list of synonyms by a comma as separator
- clean the items up with a Trim
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900