Cesar_
2008-06-27 01:00:17 UTC
Estimados Amigos,
Tengo una aplicacion VB.Net 2005, el cual al presionar un boton debe
aparecer un gif animado mientras el proceso de carga de datos que se
ejecuta en otro hilo se demora en hacerlo, el problema es que se
muestra el gif pero no es animado, he intentado de todo pero no doy
con la solucion. Aqui adjunto el codigo:
////////////////////////////////////////////////////////////////
Private dstDocumentos as DataSet = nothing
Private Sub btnFindDocument_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnFindDocument.Click
Try
pctLoading.Visible = True
'Utilize Application.DoEvents() para q se muestre el
gif pero no lo anima.
Application.DoEvents()
If lblRazonSocialProveedor.Text <> String.Empty Then
dstDocumentos = Nothing
'Lanzando en un Hilo para cargar data
Dim threadMethod As New ThreadStart(AddressOf
GetData)
Dim newThread As New Thread(threadMethod)
newThread.Name = "getDataDocument"
newThread.IsBackground = True
newThread.Start()
'Espera q el hilo termine
newThread.Join()
'Carga la data a mi datagridview dgvDocumentos
If dstDocumentos.Tables(0).Rows.Count > 0 Then
dgvDocumentos.DataSource =
dstDocumentos.Tables(0).DefaultView()
End If
Else
MessageBox.Show("No ha ingresado el Ruc. vuelva a
Buscar.", _
Me.Text & " - " &
My.Application.Info.ProductName, _
MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
txtRucProveedor.Focus()
End If
pctLoading.Visible = False
Catch ex As Exception
Modules.ControlExcepcion(Me.Name, ex)
End Try
End Sub
Private Sub GetData()
Try
'Instanciando Entidad
objBE_CuentaPagarProveedor.Cpp_Pvd_Ruc =
Trim(txtRucProveedor.Text)
'Cargando el dataSet
dstDocumentos =
objBC_CuentaPagarProveedor.ListadoxProveedor(objBE_CuentaPagarProveedor)
Catch ex As ThreadAbortException
Modules.ControlExcepcion(Me.Name, ex)
End Try
End Sub
///////////////////////////////////////////////////////
Agradesco su gran ayuda, la verdad q he intentado todo pero no se que
esta mal.
Saludos,
CESAR
Tengo una aplicacion VB.Net 2005, el cual al presionar un boton debe
aparecer un gif animado mientras el proceso de carga de datos que se
ejecuta en otro hilo se demora en hacerlo, el problema es que se
muestra el gif pero no es animado, he intentado de todo pero no doy
con la solucion. Aqui adjunto el codigo:
////////////////////////////////////////////////////////////////
Private dstDocumentos as DataSet = nothing
Private Sub btnFindDocument_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnFindDocument.Click
Try
pctLoading.Visible = True
'Utilize Application.DoEvents() para q se muestre el
gif pero no lo anima.
Application.DoEvents()
If lblRazonSocialProveedor.Text <> String.Empty Then
dstDocumentos = Nothing
'Lanzando en un Hilo para cargar data
Dim threadMethod As New ThreadStart(AddressOf
GetData)
Dim newThread As New Thread(threadMethod)
newThread.Name = "getDataDocument"
newThread.IsBackground = True
newThread.Start()
'Espera q el hilo termine
newThread.Join()
'Carga la data a mi datagridview dgvDocumentos
If dstDocumentos.Tables(0).Rows.Count > 0 Then
dgvDocumentos.DataSource =
dstDocumentos.Tables(0).DefaultView()
End If
Else
MessageBox.Show("No ha ingresado el Ruc. vuelva a
Buscar.", _
Me.Text & " - " &
My.Application.Info.ProductName, _
MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
txtRucProveedor.Focus()
End If
pctLoading.Visible = False
Catch ex As Exception
Modules.ControlExcepcion(Me.Name, ex)
End Try
End Sub
Private Sub GetData()
Try
'Instanciando Entidad
objBE_CuentaPagarProveedor.Cpp_Pvd_Ruc =
Trim(txtRucProveedor.Text)
'Cargando el dataSet
dstDocumentos =
objBC_CuentaPagarProveedor.ListadoxProveedor(objBE_CuentaPagarProveedor)
Catch ex As ThreadAbortException
Modules.ControlExcepcion(Me.Name, ex)
End Try
End Sub
///////////////////////////////////////////////////////
Agradesco su gran ayuda, la verdad q he intentado todo pero no se que
esta mal.
Saludos,
CESAR