(10-10-19, 06:52 AM)asemshahen5 كتب : الغ اللوب الخاص بالجمع و المتغيير sum فقط ضع الكود التالي هو سيقوم بالمطلوب و به اسم الليبل سيعبئها تلقائيا :
مثال :PHP كود :
Invoke(Sub() Label20.Text = (From row In DataGridView1.Rows Select CDbl(row.Cells("ActPercent").Value)).Sum().ToString("00,000.00"))
PHP كود :
Private Sub BackgroundWorker2_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
Invoke(Sub() Label20.Text = (From row In DataGridView1.Rows Select CDbl(row.Cells("ActPercent").Value)).Sum().ToString("00,000.00"))
End Sub
عفوا اخي لم ينجح معي
وضعت لحضرتك الكود الخاص بحدث ال DoWork كاملا لعلي اخطات في شيئ
PHP كود :
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
If dtPatients.Tables("Patients").Rows.Count = 0 Then
Invoke(Sub() ProgressBar1.Visible = False)
Exit Sub
End If
Dim ii As Integer = 0
Invoke(Sub() ProgressBar1.Maximum = dtPatients.Tables("Patients").Rows.Count)
Invoke(Sub() ProgressBar1.Visible = True)
If dtPatients.Tables("Patients").Rows.Count = 0 Then
Invoke(Sub() ProgressBar1.Visible = False)
End If
Invoke(Sub() DataGridView1.Rows.Clear())
ii = 0
For Each row As DataRow In dtPatients.Tables("Patients").Rows
Invoke(Sub() DataGridView1.Rows.Add(row.ItemArray))
ii += 1
BackgroundWorker1.ReportProgress(ii)
Invoke(Sub() Label10.Text = ii)
Application.DoEvents()
Next
Invoke(Sub() Label20.Text = (From row In DataGridView1.Rows Select CDbl(row.Cells("ActPercent").Value)).Sum().ToString("00,000.00"))
End Sub