需要以某种方式将每个季节的季数和剧集数从维基百科表中复制到两个组合框中。一个用于季节,另一个用于剧集。应该允许用户输入他们最喜欢的应用程序显示在顶部输入框中。然后用季节数填充第一个组合框,当用户选择一个时,将显示相关的剧集数
链接到每个季节的季数和剧集数的表格: http ://en.wikipedia.org/wiki/List_of_House_episodes#Series_overview_and_ratings
代码:
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
到目前为止,我已经发现了如何下载页面源,甚至稍微操作了页面,但我不知道如何使用它来将每个季节的季数和剧集数放入组合框中。任何帮助都会非常感谢
代码:
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