Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub BTNGetLanguaje_Click(sender As Object, e As EventArgs) Handles BTNGetLanguaje.Click
- 'this will get the source code of the page that i want to extract the languages
- Scrapping.DownloadHtmlPage("Http://prod.etim-international.com/class", tbHTMLSourceCodeLanguage)
- 'this will clear the code (Remove the quotes)
- Scrapping.ClearHtmlTB(tbHTMLSourceCodeLanguage)
- 'this will get only the option select which contains the languages option
- 'first declare my variables start tag, end tag, and htmlcode
- Dim starttag = "name=#LanguageCode#>"
- Dim endtag = "</select> "
- Dim htmlcode = tbHTMLSourceCodeLanguage.Text
- 'this will place the result in the textbox tbhtmlsourcecodelanguage
- Scrapping.FindTextBetweenTags(starttag, endtag, htmlcode, tbHTMLSourceCodeLanguage)
- ' everything that is between the tags options will be added to listbox1
- Dim starttaglistbox = "<option"
- Dim endtaglistbox = "</option>"
- Scrapping.AddMatchToListBox(tbHTMLSourceCodeLanguage, starttaglistbox, endtaglistbox, ListBox1)
- 'for every item in listbox do the following
- For Each item In ListBox1.Items
- TBLanguageHelper.Text = "" 'this will clear the textbox so a value can be placed
- TBLanguageHelper.Text = item 'this will make the textbox equal to the value of the item
- 'this will remove part of the tags before the value option
- 'we do this to keep the value so when we go to the click method we will have the rigth value
- TBLanguageHelper.Text = TBLanguageHelper.Text.Replace("</option>", "")
- TBLanguageHelper.Text = TBLanguageHelper.Text.Replace("<option value=#", "")
- TBLanguageHelper.Text = TBLanguageHelper.Text.Replace("<option selected=#selected# value=#", "")
- CBLanguages.Items.Add(TBLanguageHelper.Text)
- Next
- End Sub
- Private Sub CBLanguages_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CBLanguages.SelectedIndexChanged
- tbvalue.Text = CBLanguages.Text
- 'this will keep only 2 digits
- tbvalue.Text = tbvalue.Text.Substring(0, 2)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement