Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/06/2014, 10:38
hades0024
 
Fecha de Ingreso: junio-2014
Mensajes: 10
Antigüedad: 9 años, 11 meses
Puntos: 0
Respuesta: como guardar datos en una matriz desde un archivo csv

Ok. muchas gracias por responder, la verdad tuve que mejorar el cod. para poder buscar por 'codigo', porque se demoraba mucho en buscar por ej. el ultimo (el .csv es grande)

adjunto parte de lo que hice.

Código vb:
Ver original
  1. Public objR As New StreamReader("\archivo.csv")
  2.     Public oLine As String = ""
  3.     Public oTexto As New ArrayList()
  4.     Public split() As String
  5.  
  6. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.  
  8.         Do
  9.             oLine = objR.ReadLine
  10.             If Not oLine Is Nothing Then
  11.                 oTexto.Add(oLine)
  12.             End If
  13.         Loop Until oLine Is Nothing
  14.         objR.Close()
  15.     End Sub
  16.  
  17. <BOTON>
  18.  
  19. Dim bool As Boolean = False
  20.         For Each Me.oLine In oTexto
  21.             split = oLine.Split(";")
  22.             If Not oLine Is Nothing Then
  23.                 For i = 0 To split.Length - 1
  24.                     If split(i) = split(Nº_columna_codigo) Then
  25.                         If TextBox1.Text = split(i) Then
  26.                             If TextBox1.Text <> "" Then
  27.                                 bool = True
  28.                                 TextBox2.Text = ("Se encuentra el código")
  29.                              End If
  30.                         End If
  31.                     End If
  32.                 Next
  33.             End If
  34.         Next
  35.         If Not bool Then
  36.             MsgBox("No se encontro el código")
  37.         End If
  38.         oTexto.Add(oLine)