Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/08/2013, 22:24
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
Respuesta: Archivo Txt sin caracteres de separacion datagridview vb.net

Buenas noches Amigo emmax Gracias por la Ayuda, por tu valiosa ayuda, probe lo que me indicaste y final mente Funciona.
Asi queda el codigo para aquellos compañeros que tengan la misma duda y lo puedan usar cuando esten en situaciones similares.
Este codigo lo tengo para un Button el cual llamo Cargar, Agrego tambien que uso otro Button el cual llamo Examinar para buscar el archivo y uso tambien un OpenFileDialog y un TextBox

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
texto = leer.ReadLine()
Dim primerdato As String = texto.Substring(0, 2).ToString()
Dim segundodato As String = texto.Substring(2, 3).ToString()
Dim tercerdato As String = texto.Substring(5, 8).ToString()
DataGridView1.Rows.Add(primerdato, segundodato, tercerdato)
Else
MsgBox("Seleccione el archivo a cargar", MsgBoxStyle.Exclamation, "Error")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub