Bonjour,
voila je suis en train de faire une application qui réalise une copie puis une suppression de fichiers. j'arrive a faire la copie sans aucun soucis. à la fin de la copie la méthode bgwCode_Completed est appelée. Dans cette méthode j'appel un autre BackgroudWorker :
Declaration :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Private WithEvents bgwCode As System.ComponentModel.BackgroundWorker Private WithEvents bgwAction As System.ComponentModel.BackgroundWorkerMalheureusement j'ai une exception :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Sub bgwCode_Completed(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgwCode.RunWorkerCompleted ProgressBar.Value = 0 If action.Equals("1") Then lbl_listBox_title.Text = "List of files copied :" 'lbl_file_copied.Text = "Number of files copied :" lbl_num_file.Text = Str(cpFile) + " files" btn_scan.Enabled = True btn_copy.Text = "Copy" End If If action.Equals("2") Then lbl_progress.Text = "0% of deleted cache" End If If action.Equals("3") Then lbl_progress.Text = "0% of deleted not media files" End If If action.Equals("4") Then lbl_progress.Text = "0% of deleted not copied files" End If If Not action.Equals("1") Then bgwAction.RunWorkerAsync() End If End Sub
Je ne sais pas si j'ai le droit d'appeler un autre backGroundWorker...System.Reflection.TargetInvocationException was unhandled
Message="Exception has been thrown by the target of an invocation."
Est ce que vous avez des remarques ??
Merci
Partager