CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2012
    Posts
    2

    Question How do I copy info from Wikipedia table to combo boxes? - Really annoying me..

    need to somehow copy the number of seasons and episodes in each season from a Wikipedia table into two combo boxes. One for seasons and the other for episodes. The apps supposed to allow the user to type in their favorirte show in the top input box.
    Then fill the first combo box with the number of seasons and when the user selects one the relevant number of episodes are shown



    My code so far is here

    Public Class Form1
    Dim Search As String
    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    Search = TextBox1.Text
    Search = Search.Replace(" ", "+")
    Search = "http://www.google.com/search?btnI=I'm+Feeling+Lucky&q=" & Search & "episode+list+wikipedia"


    If Asc(e.KeyChar) = 13 Then


    WebBrowser1.Navigate(Search)
    TextBox1.Text = Search




    End If
    End Sub
    End Class

  2. #2
    Join Date
    Dec 2012
    Posts
    2

    Re: How do I copy info from Wikipedia table to combo boxes? - Really annoying me..

    So far I've found out howto download the page source even manipulate the page a little but I don't know how to use this to get the number of seasons and episodes in each season into combo boxes. Any help would be great thanks

    Code:

    Imports System.Text.RegularExpressions

    Public Class Form1
    Dim sourcecode As String
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    sourcecode = ((New Net.WebClient).DownloadString("http://en.wikipedia.org/wiki/List_of_House_episodes#Series_overview_and_ratings"))

    Dim Code As String
    Dim Information As MatchCollection = Regex.Matches(sourcecode, "<td>(.*?)</td>", RegexOptions.None)
    For Each Info In Information
    Code = Regex.Replace(Info.ToString, "td>", "", RegexOptions.None)
    Code = Regex.Replace(Code, "</td>", "", RegexOptions.None)
    MsgBox(Code)
    Next
    End Sub
    End Class

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How do I copy info from Wikipedia table to combo boxes? - Really annoying me..

    If ForEach goes thru them all, then just add a counter, and add one each time?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: How do I copy info from Wikipedia table to combo boxes? - Really annoying me..

    Web Scraping is not really allowed here, as activities such as that is against the AUP. I am closing this thread now. If you want me to re-open this thread, please feel free to send me a PM with your legal reasoning bebind this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured