A
Alhambra Eidos Kiquenet
Hi misters,
I using BackgroundWorker control in my Windows Forms. In my form, I have a
SplitterPanel.
In DoWork event , I create controls child, and in ProgressChanged event I
try add controls to SplitterPanel, but the application not responds. I use
InvokeRequired for controls child.
Any suggestions, please ?
Thanks in advance.
Private Sub bgCargaFichero_DoWork(ByVal sender As System.Object, ByVal e As
System.ComponentModel.DoWorkEventArgs) Handles bgCargaFichero.DoWork
Try
'SplitContainer1.Panel1.SuspendLayout()
'SplitContainer1.Refresh()
' Procesar fichero
Me.ProcesarFicheroCargadoWork() ' IN THIS METHOD I CREATE CONTROLS Type =
ContenedorVisorBase
'SplitContainer1.Panel1.ResumeLayout(False)
If bgCargaFichero.CancellationPending = True Then
e.Cancel = True
Else
e.Result = True
End If
End Sub
Private Sub bgCargaFichero_ProgressChanged(ByVal sender As System.Object,
ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles
bgCargaFichero.ProgressChanged
Dim contenedorPagina As
GRUPOBACKUP.Administrador.Util.Cliente.ControlesWindows.ContenedorVisorBase =
Nothing
contenedorPagina = CType(e.UserState,
GRUPOBACKUP.Administrador.Util.Cliente.ControlesWindows.ContenedorVisorBase)
If contenedorPagina IsNot Nothing Then
AddMiniaturaToPanel(contenedorPagina)
End If
=====
Delegate Sub AddMiniaturaToPanelDelegate2(ByVal cCTL As Control)
Private Sub AddMiniaturaToPanel(ByVal cCTL As Control)
If cCTL.InvokeRequired Then
Dim d As New AddMiniaturaToPanelDelegate2(AddressOf AddMiniaturaToPanel)
Me.Invoke(d, New Object() {cCTL})
Else
SplitContainer1.Panel1.Controls.Add(cCTL) ' Here, the application not
responds !!!!
End If
End Sub
I using BackgroundWorker control in my Windows Forms. In my form, I have a
SplitterPanel.
In DoWork event , I create controls child, and in ProgressChanged event I
try add controls to SplitterPanel, but the application not responds. I use
InvokeRequired for controls child.
Any suggestions, please ?
Thanks in advance.
Private Sub bgCargaFichero_DoWork(ByVal sender As System.Object, ByVal e As
System.ComponentModel.DoWorkEventArgs) Handles bgCargaFichero.DoWork
Try
'SplitContainer1.Panel1.SuspendLayout()
'SplitContainer1.Refresh()
' Procesar fichero
Me.ProcesarFicheroCargadoWork() ' IN THIS METHOD I CREATE CONTROLS Type =
ContenedorVisorBase
'SplitContainer1.Panel1.ResumeLayout(False)
If bgCargaFichero.CancellationPending = True Then
e.Cancel = True
Else
e.Result = True
End If
End Sub
Private Sub bgCargaFichero_ProgressChanged(ByVal sender As System.Object,
ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles
bgCargaFichero.ProgressChanged
Dim contenedorPagina As
GRUPOBACKUP.Administrador.Util.Cliente.ControlesWindows.ContenedorVisorBase =
Nothing
contenedorPagina = CType(e.UserState,
GRUPOBACKUP.Administrador.Util.Cliente.ControlesWindows.ContenedorVisorBase)
If contenedorPagina IsNot Nothing Then
AddMiniaturaToPanel(contenedorPagina)
End If
=====
Delegate Sub AddMiniaturaToPanelDelegate2(ByVal cCTL As Control)
Private Sub AddMiniaturaToPanel(ByVal cCTL As Control)
If cCTL.InvokeRequired Then
Dim d As New AddMiniaturaToPanelDelegate2(AddressOf AddMiniaturaToPanel)
Me.Invoke(d, New Object() {cCTL})
Else
SplitContainer1.Panel1.Controls.Add(cCTL) ' Here, the application not
responds !!!!
End If
End Sub