منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : لماذ لا يعمل ProgressBar الا مرة واحده في هذا الكود + المشروع
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
سلام عليكم

الخلل في الكود ادناه والمشكلة تكمن في


ان  ProgressBar
يظهر عمله لمرة واحدة فقط




PHP كود :
Private Sub BackgroundWorker1_DoWork(sender As ObjectAs System.ComponentModel.DoWorkEventArgsHandles BackgroundWorker1.DoWork
        Dim i 
As Integer
        For i 
0 To ListBox1.Items.Count 1
                Me
.emad1.Send(String.Concat(New String() {"<iq from='"Me.emad1.Username.ToString"@nimbuzz.com/"Me.emad1.Resource"' type='set' to='uprofile.nimbuzz.com' id='pcClient-299'><profile xmlns='http://jabber.org/protocol/profile'><x xmlns='jabber:x:data' type='submit'><field type='hidden' var='FORM_TYPE'><value>http://jabber.org/protocol/profile</value></field><field var='nickname'><value>"Me.TextBox3.Text"</value></field></x></profile></iq>"}))
 
               Me.emad1.Send(String.Concat(New String() {"<presence to='" ListBox1.Items(i) & "@s.chatp.net' type='subscribe'/>"}))
 
               Me.emad1.Send(String.Concat(New String() {"<message type='chat' id='purple8c986e43' to='" ListBox1.Items(i) & "@s.chatp.net'><active xmlns='http://jabber.org/protocol/chatstates'/><body>" Form2.TextBox1.Text "</body></message>"}))
 
               Me.emad1.Send(String.Concat(New String() {"<message type='chat' id='purple8c986e43' to='" ListBox1.Items(i) & "@s.chatp.net'><active xmlns='http://jabber.org/protocol/chatstates'/><body>" Form2.TextBox2.Text "</body></message>"}))
 
               Me.emad1.Send(String.Concat(New String() {"<message type='chat' id='purple8c986e43' to='" ListBox1.Items(i) & "@s.chatp.net'><active xmlns='http://jabber.org/protocol/chatstates'/><body>" Form2.TextBox3.Text "</body></message>"}))
 
               Me.emad1.Send(String.Concat(New String() {"<message type='chat' id='purple8c986e43' to='" ListBox1.Items(i) & "@s.chatp.net'><active xmlns='http://jabber.org/protocol/chatstates'/><body>" Form2.TextBox4.Text "</body></message>"}))
 
               Threading.Thread.Sleep(1000)
 
           Dim a As Integer = (i)
 
           Dim b As Integer = (ListBox1.Items.Count)
 
           Me.ProgressBar1.Invoke(Sub()
 
                                      Me.ProgressBar1.Value = ((1) / (b)) * 100
                                   End Sub
)
 
           Label14.Text = (ListBox1.Items(i))
 
           Next
        Me
.id1.Clear()

 
   End Sub 
السلام عليكم ورحمة الله وبركاته 

تم حل المشكلة 

في المرفقات ..... 

تحياتي ....
المشكلة كما هي لم يحل شئ والكود كما هو ؟؟
أخي الفاضل هل هذا هو المطلوب تحميل ProgressBar  ؟ 

أم تريد تحميله عند إجراء معين 



يمكن هذا هو المطلوب

كود :
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
       If ProgressBar1.Value = 100 Then
           ProgressBar1.Value = 0
           BackgroundWorker1.RunWorkerAsync()
       Else
           BackgroundWorker1.RunWorkerAsync()
       End If
   End Sub