Ver Mensaje Individual
  #18 (permalink)  
Antiguo 02/07/2009, 16:32
Avatar de MeXiCaN
MeXiCaN
 
Fecha de Ingreso: mayo-2004
Ubicación: Barcelona - España , Morelia - México
Mensajes: 162
Antigüedad: 20 años
Puntos: 0
Respuesta: Thread lectura de archivo

Solucionado el tema de threads, pensé que era muchos más dificil.

Cita:
Dim Thread_lectura_fich As New Thread(AddressOf Thread_lec_fich)
Thread_lectura_fich.Start()
Thread_lec_fich()
Estas 3 lineas las tengo en el botón de cargar el ficheros, son la declaración del thread y su Sub correspondiente.

Cita:
Private Sub Thread_lec_fich()
Obtener_Ruta() // función para obetener la ruta de archivo
Dim b_fich As String variable con la ruta del archivo actual

If System.IO.Directory.Exists(rutafich) Then
Dim files_dir As Array = System.IO.Directory.GetFiles(rutafich)
Dim j As Integer
Dim t As Integer = UBound(files_dir)
For j = 0 To j = 1
b_fich = files_dir(j)
F = CreateObject("Scripting.FileSystemObject")
A = F.OpenTextFile(b_fich)
While A.AtEndOfStream <> True
Me.TextBox1.Text = Me.TextBox1.Text + vbNewLine + A.ReadLine
Me.TextBox1.Refresh()
End While
A.Close()
Next j
Else
MsgBox("El fichero solicitado no existe.", MsgBoxStyle.Information)
End If
End Sub
__________________
Un saludo, MeXiCaN :golpeado: :adios:

Poco es tanto, cuando poco necesitas. E.Bunbury

Siempre que haya una causa noble por la que luchar, siempre habrá ladrones que la apoyarán.