Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/08/2013, 14:39
Avatar de gonzalezjesus_77
gonzalezjesus_77
 
Fecha de Ingreso: julio-2013
Ubicación: venezuela
Mensajes: 11
Antigüedad: 10 años, 9 meses
Puntos: 0
Información Archivo Txt sin caracteres de separacion datagridview vb.net

Buenas tardes, amigos de forum , les dejo mi siguinte duda. tengo un archivo txt que no posee caracteres de separacion, es decir, es una cadena que tiene 119 caracteres, ¿como hago para cargarlo en un datagridview (extraer), cada dato por separado. Necesito ayuda amigos

El codigo que uso es este:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try

If (TextBox1.Text <> String.Empty) Then
Dim leer As New StreamReader(TextBox1.Text)
Dim texto As String = ""
Dim count As Integer = 3
Dim myChar As Char
Dim split As Char() = Nothing
While (Not texto Is Nothing)
texto = leer.ReadLine()
If (Not texto Is Nothing) Then
split = texto.Split(String.Join(CStr(3))),count)
DataGridView1.Rows.Add(split(0), split(1), split(2))
End If
End While

Else
MsgBox("Seleccione el archivo a cargar", MsgBoxStyle.Exclamation, "Error")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub