Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18-09-2007, 18:28:38
el_trocha el_trocha is offline
Junior Member
Site Admin
 
Registrado: sep 2007
Posts: 6
el_trocha Valoración +2
Predeterminado PROGRSS BAR Necesito ayuda.......POR FAVOR

Mirad camaradas, tengo el siguiente codigo en mi aplicacion y no consigo hacer que mi progress bar funcione y no se por que.

Espero me podais ayudar.


CLIENTE:

Private Sub btdescarga_Click() 'boton que le dice al servidor que inicia la descarga del archivo de esa ruta que hemos introducido en un txtbox

rutadestino = "C:\Documents and Settings\Armando_Bollos\Mis documentos\Mis archivos recibidos\Archivos Recibidos\" & fileselect

Open rutadestino For Binary As #2

y = "tamaño-"
wc.SendData y & txtruta.Text 'enviamos la ruta del archivo al server.

donde = "tamaño" 'Le pedimos que mande el resultado al case tamaño del datarrival

LLEGADA AL SERVER DE LA INFORMACION:


Case "tamaño"

rutafile = vdatos(1)

Call tamaño



Private Sub tamaño()

Dim size As String

Open rutafile For Binary Access Read As #3

size = CStr(LOF(3)) ' calculamos su tamaño

Close #3

ws.SendData size ' Envia al cliente el tamañodel archivo

End Sub

LLEGADA AL CLIENTE DE LA INFORMACION:

Case "tamaño"

tamañofile = datos 'Meto en esa variable el tamaño del archivo
PB.Min = (datos - datos) ' Pongo elminimo de la barra de pregreso
PB.Max = datos ' pongo el maximo de la barra de progreso

PB.Value = PB.Min ' establezco el valor de la barra de progreso
sizefilerecibido = 0 ' establezco el valor que ira sumando los bytes que vayan entrando

y = "descarga-"
wc.SendData y & txtruta.Text 'envio al server que puede empezar a enviar datos

donde = "descarga"

LLEGADA DE DATOS AL SERVER :

Case "descarga"

On Error GoTo errores

Dim tamañofile As Long

rutafile = vdatos(1)

Open rutafile For Binary Access Read As #2
tamañofile = LOF(2)
ReDim file(tamañofile - 1)
Get #2, , file

ws.SendData file
ws.SendData "Fin"

Close #2

End Sub


LLEGADA DE DATOS AL CLIENTE:

Case "descarga"

On Error Resume Next

Put #2, , datos

sizefilerecibido = sizefilerecibido + bytesTotal 'Sumo a la variable los datos que van entrando

PB.Value = sizefilerecibido 'asigno el valor de la variable al valor de la progres bar

If Right(datos, 3) = "Fin" Or datos = "Fin" Then

If sizefilerecibido >= sizefile Then

Close #2

sizefilerecibido = 0

PB.Value = PB.Max

MsgBox "Descarga Finalizada", vbOKOnly

End If

PB.Value = 0

End If


Espero me podais ayudar. Un saludo. Muchas gracias.
Responder Con Cita