1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Private Sub backgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles backgroundWorker1.DoWork
Dim Frm As New Form2
With Frm
.DataGListe.DataSource = .BindingSourceListe
Try
TableListe = New DataTable
Cmd = New SqlCommand("Compta.P_Balance_Generale", Connexion)
Cmd.CommandType = CommandType.StoredProcedure
.SqlDAListe = New SqlDataAdapter(Cmd)
.SqlDAListe.Fill(TableListe)
.BindingSourceListe.DataSource = TableListe
.LbNbr.Text = TableListe.Rows.Count
......
.DataGListe.Rows(0).DefaultCellStyle.Font = New Font(Control.DefaultFont, FontStyle.Bold)
For Each Colonne As DataGridViewColumn In .DataGListe.Columns
Colonne.SortMode = DataGridViewColumnSortMode.NotSortable
Next
Catch ex As Exception
Msgbox(ex.tostring)
End Try
End With
BgwConnect.ReportProgress(1, Frm)
Dim nbr As Integer = 400
Dim compteur As Integer = 0
Dim delegateIncrement As dIncrement = AddressOf Increment
Do
compteur = delegateIncrement(compteur)
backgroundWorker1.ReportProgress((compteur * 100) / nbr)
If Me.backgroundWorker1.CancellationPending = True Then
e.Result = compteur
Exit Do
End If
Loop Until compteur = nbr
e.Result = compteur
End Sub
Private Sub backgroundWorker1_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Handles backgroundWorker1.ProgressChanged
If e.ProgressPercentage = 1 Then
TryCast(e.UserState, Form2).ShowDialog()
End If
End Sub |
Partager