The thing is happening when i'm trying to write a file with this io. namespace.
Don't know if haveing more than 1 IO. process affects one another?
The error i'm getting says "" the file is already been use by another process". Can't get it to work. I'm creating the file then writeing on it but still nothing happens. Gonna include the vb code.
Code:Dim myfile As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\dos2.txt" Dim fw As New IO.FileStream(Application.StartupPath + "\descarga.txt", IO.FileMode.Create, IO.FileAccess.Write) Dim sw1 As New IO.StreamWriter(fw) Tmr9.Interval = 1 tenvios = 0 envio = 0 lstLOG.Items.Add(CStr(Now) + " Proceso iniciado......timer9 ") arch = CreateObject("Scripting.FileSystemObject") lstLOG.Items.Add(CStr(Now) + " Ordenando Archivos") lstLOG.Refresh() file = arch.opentextfile(myfile, 1) 'here just been open to later on be reading the lines on the textfile sw1.WriteLine("user") sw1.WriteLine("password") sw1.WriteLine("cd salida") sw1.WriteLine("mget *.pgp") Process.Start("C:\Documents and Settings\rguifarro\Mis documentos\Visual Studio 2005\Projects\BancomerProto\desc.mdb", AppWinStyle.Hide) i = 0 While i = 0 While Not file.AtEndOfStream linea = file.readline If Len(linea) > 3 Then linea = Mid(linea, 1, Len(linea) - 1) nomdesc = Microsoft.VisualBasic.Left(linea, (Len(linea) - 4)) tenvios = tenvios + 1 lstLOG.Items.Add(CStr(Now) + " Archivo " + linea + " Listo para Descarga") sw1.WriteLine("y") i = i + 1 End If End While If i = 0 Then i = 100 End If End While If i = 100 Then lstLOG.Items.Add(CStr(Now) + " No hay archivos para procesar.") Exit Sub End If sw1.WriteLine("bye") sw1.Close() 'here it should close the writer but nothing happens fw.Close() fw.Dispose() file.Close()




Reply With Quote