06-02-14, 01:11 PM
طبق المثال السريع هذا باستخدام RegularExpressions
اضف الادوات التالية:
Button1
backgroundworker
2 textbox
progressbar
استدعي الاتي:
عرف عموميا التالي:
في حدث تحميل الفورم اكتب:
في حدث النقر لزر الامر اكتب
bb = backgroundworker
في حدث bb_DoWork اكتب:
في حدث bb_ProgressChanged اكتب:
p=progressbar
في حدث bb_RunWorkerCompleted اكتب:
[/code]
[/align]
اضف الادوات التالية:
Button1
backgroundworker
2 textbox
progressbar
استدعي الاتي:
كود :
Imports System.Net
Imports System.Text.RegularExpressionsكود :
Dim str As String = "showthread.php"
Dim mcoll As MatchCollection
Dim ob As Stringكود :
Dim wc As New WebClient
TextBox1.Text = wc.DownloadString("http://vb4arb.com/vb/index.php")في حدث النقر لزر الامر اكتب
كود :
If bb.IsBusy Then Exit Sub
mcoll = Regex.Matches(TextBox1.Text, str)
p.Maximum = mcoll.Count
bb.ReportProgress(mcoll.Count)
bb.RunWorkerAsync()في حدث bb_DoWork اكتب:
كود :
For Each ma As Match In mcoll
ob &= ma.Value & vbNewLine
Nextكود :
p.Value = e.ProgressPercentageكود :
TextBox2.Text = ob
MsgBox("done")
وهذا الكلاس بشكل كامل
[align=left][code]
Imports System.Net
Imports System.Text.RegularExpressions
Public Class Form1
Dim str As String = "showthread.php"
Dim mcoll As MatchCollection
Dim ob As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wc As New WebClient
TextBox1.Text = wc.DownloadString("http://vb4arb.com/vb/index.php")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If bb.IsBusy Then Exit Sub
mcoll = Regex.Matches(TextBox1.Text, str)
p.Maximum = mcoll.Count
bb.ReportProgress(mcoll.Count)
bb.RunWorkerAsync()
End Sub
Private Sub bb_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bb.DoWork
For Each ma As Match In mcoll
ob &= ma.Value & vbNewLine
Next
End Sub
Private Sub bb_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bb.ProgressChanged
p.Value = e.ProgressPercentage
End Sub
Private Sub bb_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bb.RunWorkerCompleted
TextBox2.Text = ob
MsgBox("done")
End Sub
End Class[/align]
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير

