Tengo problemas para "leer" un archivo de texto, y posteriormente, asignar los valores entre cada separador (un tabulador) una variable (que sería lo semejante a un campo de una base de datos tipo acces), para cada fila (registro).
¿me podrían ayudar? Muchas gracias
Mi código es el siguiente y no se lo que está mal
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\D ocuments\hola.txt")
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters("vbTAb")
Dim well, sample_name, detector, task, ct, StdDev_Ct, Qty_Mean, Qty As Long
While Not MyReader.EndOfData
Try
Dim line As String = MyReader.ReadLine
Dim value() As String = line.Split("vbTab")
well = value(1)
sample_name = value(2)
detector = value(3)
task = value(4)
ct = value(5)
StdDev_Ct = value(6)
Qty_Mean = value(7)
Qty = value(8)
Dim salida2 As String = well & "," & sample_name & "," & Qty & vbNewLine
My.Computer.FileSystem.WriteAllText("C:\Documents\ adios.txt", salida2, True)
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineExceptio n
MsgBox("Linea " & ex.Message & "no es valida y se va a saltar.")
End Try
End While
End Using
End Sub