ウィキペディアのテーブルから各シーズンのシーズン数とエピソード数を 2 つのコンボ ボックスに何らかの方法でコピーする必要があります。1 つはシーズン用、もう 1 つはエピソード用です。ユーザーが上部の入力ボックスにお気に入りの番組を入力できるようにするアプリ。次に、最初のコンボ ボックスにシーズン数を入力します。ユーザーがシーズン数を選択すると、関連するエピソード数が表示されます。
シーズン数と各シーズンのエピソード数の表へのリンク: 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