Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/09/2008, 15:06
Avatar de moradazo
moradazo
 
Fecha de Ingreso: julio-2008
Ubicación: [email protected]
Mensajes: 355
Antigüedad: 15 años, 10 meses
Puntos: 2
Respuesta: Como pasar a la siguiente linea de un archivo plano (txt)

Este codigo me lo brindo Avellaneda:

Código PHP:
Private Sub funcion()
        
Dim ip As IntPtr Runtime.InteropServices.Marshal.AllocHGlobal(100000)
        
Dim sb As New System.Text.StringBuilder(100000)
        
Dim bt As Integer GetPrivateProfileSection("Nombre"ip100000"C:/tu_archivo.txt")
        Try
            For 
As Integer 0 To bt 1
                sb
.Append(Convert.ToChar(Runtime.InteropServices.Marshal.ReadByte(ipi)))
            
Next
            sb
.Remove(sb.Length 11)
            For 
Each line As String In sb.ToString().Split(Convert.ToChar(0))
                
Dim iPos As Integer InStr(line",") - 1
                text1
.Text Microsoft.VisualBasic.Right(lineLen(line) - iPos)
                
text2.Text Microsoft.VisualBasic.Right(lineLen(line) - iPos 1)
                
text3.Text Microsoft.VisualBasic.Right(lineLen(line) - iPos 2)
                
text4.Text Microsoft.VisualBasic.Right(lineLen(line) - iPos 3)
            
Next
        
Catch ex As System.Exception
            System
.Windows.Forms.MessageBox.Show(ex.Message)
        
Finally
            Runtime
.InteropServices.Marshal.FreeHGlobal(ip)
        
End Try
        
FileClose(0)
    
End Sub 
Tu archivo de texto debes tener un encabezado entre corchetes, en este caso asi [Nombre] como aparece arriba en el GetPrivateProfileSection que es el que leerá el archivo de texto.

Espero te sirva.