프로젝트 압축파일입니다.
폼의 형태입니다.
(Dock = Fill)
아래는 소스코드입니다.
Form1.vb
Imports System.Net Imports System.IO Imports System.Text Imports System.Text.Regularexpressions Imports System.Threading Public Class Form1 Public id2 As String Public dataHtml As String = "" Private Matches, Matches2, Matches3, MatchesID, MatchesIMG, MatchesLevel, matches종족 As MatchCollection Private Regex As Regex Dim count As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ListView1.Items.Clear() on Error Resume Next Module1.httpdown("http://search.archeage.com/search?keyword=" & TextBox1.Text.ToString & "&dt=characters&ft=txt&sf=score&st=desc&start=10&page=2") Module1.httpdown("http://search.archeage.com/search?keyword=" & TextBox1.Text.ToString & "&dt=characters&ft=txt&sf=score&st=desc&start=0&page=1") Dim count As Integer Dim 정규식캐릭명 As New Regex("<strong>(.*?)</strong>\s", RegexOptions.IgnoreCase) Dim 정규식서버명 As New Regex("<span class=""character_server"">@(.*?)</span>", RegexOptions.IgnoreCase) Dim 정규식ID As New Regex("characters/(.*?)/profileImage", RegexOptions.IgnoreCase) Dim 정규식Level As New Regex("<span>(.*?)레벨</span>", RegexOptions.IgnoreCase) Dim 정규식Image As New Regex("<img src=""(.*?)"" alt="""" class=""character_thumb""", RegexOptions.IgnoreCase) Dim 정규식종족 As New Regex("\n\t\t\t<span>(.*?)</span>", RegexOptions.IgnoreCase) Matches = 정규식캐릭명.Matches(dataHtml) Matches2 = 정규식서버명.Matches(dataHtml) MatchesLevel = 정규식Level.Matches(dataHtml) matches종족 = 정규식종족.Matches(dataHtml) MatchesID = 정규식ID.Matches(dataHtml) MatchesIMG = 정규식Image.Matches(dataHtml) count = Matches.Count For i = 0 To count - 1 ListView1.Items.Add(Matches.Item(i).Groups.Item(1).ToString) ListView1.Items.Item(i).SubItems.Add(Matches2.Item(i).Groups.Item(1).ToString) ListView1.Items.Item(i).SubItems.Add(MatchesLevel.Item(i).Groups.Item(1).ToString) ListView1.Items.Item(i).SubItems.Add(matches종족.Item(i * 3 + 1).Groups.Item(1).ToString) ListView1.Items.Item(i).SubItems.Add(matches종족.Item(i * 3 + 2).Groups.Item(1).ToString) ListView1.Items.Item(i).SubItems.Add(MatchesID.Item(i).Groups.Item(1).ToString) Next TextBox1.Focus() TextBox1.SelectAll() dataHtml = "" End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub TextBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp If e.KeyCode = Keys.Return Then Button1_Click(sender, e) End If End Sub Private Sub ListView1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick id2 = ListView1.FocusedItem.SubItems(5).Text Form2.Size = New System.Drawing.Size(780, 600) form2.Show()
End Sub Private Sub Form1_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated TextBox1.Focus() TextBox1.SelectAll() End Sub End Class |
Form2.vb
Public Class Form2 Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load WebBrowser1.Navigate("http://play.archeage.com/characters/" & Form1.id2.ToString) Me.Text = Form1.id2.ToString End Sub End Class |
Module1.vb
Imports System.Net Public Module Module1 Public Sub httpdown(Optional ByVal 주소 As String = "http://blog.daum.net/pootbar") on Error Resume Next Dim data As String = "" Dim wReq As WebRequest = WebRequest.Create(주소) Dim wResp As WebResponse = wReq.GetResponse Dim RespStream As System.IO.Stream = wResp.GetResponseStream Dim Reader As System.IO.StreamReader = New System.IO.StreamReader(RespStream, System.Text.Encoding.UTF8) Dim RespHTML() As String = Split(Split(Reader.ReadToEnd, "검색결과</h4>", 2)(1), "pg_inne", 2) Form1.dataHtml = RespHTML(0) & Form1.dataHtml End Sub End Module |
'프로그래밍언어 > VB.NET' 카테고리의 다른 글
핫키 설정하기 (0) | 2013.02.14 |
---|---|
비베로 치트엔진 튜토리얼8 통과하기(포인터) (0) | 2013.02.13 |
[4]웹파싱? httprequest를 통해 html을 따와서 잘라내봅시다 (0) | 2013.02.01 |
[3]웹파싱? httprequest를 통해 html을 따와서 잘라내봅시다 (0) | 2013.02.01 |
[2]웹파싱? httprequest를 통해 html을 따와서 잘라내봅시다 (0) | 2013.02.01 |