ayuda con esto lo que hago es que los dados de un windows form me los saca en un archivo de texto y despues yo leo esa informacion y la muestro en un data grid donde el primer renglon son los titulos y el segundo reglon son los valores de
mi windows forms
COMO HAGO PARA QUE ME LOS GUARDE BIEN
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'GUARDAR ARCHIVOS EN EL PC
Dim escritor As System.IO.StreamWriter
escritor = New System.IO.StreamWriter("C:\ahofacturas\facturas\facturado.txt", True)
escritor.WriteLine(";" & NumeroF.Text & ";" & TextBox1.Text & ";" & TextBox2.Text & ";" & TextBox3.Text & ";" & TextBox4.Text & ";" & TextBox5.Text & ";" & TextBox6.Text & ";" & TextBox7.Text & ";" & DateTimePicker1.Value & ";" & DateTimePicker2.Value & ";" & ComboBox1.SelectedItem & ";" & TextBox9.Text & ";" & ComboBox2.SelectedItem & ";" & TextBox11.Text & ";" & TextBox12.Text & ";" & TextBox13.Text & ";" & TextBox18.Text & ";" & ComboBox3.SelectedItem & ";" & TextBox16.Text & ";" & TextBox15.Text & ";" & TextBox14.Text & ";" & TextBox28.Text & ";" & ComboBox4.SelectedItem & ";" & TextBox26.Text & ";" & TextBox25.Text & ";" & TextBox24.Text & ";" & TextBox23.Text & ";" & ComboBox5.SelectedItem & ";" & TextBox21.Text & ";" & TextBox20.Text & ";" & TextBox19.Text & ";" & TextBox33.Text & ";" & ComboBox6.SelectedItem & ";" & TextBox31.Text & ";" & TextBox30.Text & ";" & TextBox29.Text & ";" & TxtLetras.Text & ";" & TextBox35.Text & ";" & TextBox34.Text & ";" & TextBox36.Text)
escritor.Close()
'boton reja
'LISTADO
Dim R As New IO.StreamReader("C:\ahofacturas\facturas\facturado.txt")
lecturaArchivo(DataGridView1, ";", ARCHIVO)
R.Close()
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
tambien con esto
Module Leer
'Leer el archivo y llama al metodo agregarFilaDatagridview para que por cada linea del bloc agregue una linea en el datagridview'
Sub lecturaArchivo(ByVal tabla As DataGridView, ByVal caracter As String, ByVal ruta As String)
Dim objReader As New StreamReader("C:\ahofacturas\facturas\facturado.txt")
Dim sLine As String = ""
Dim fila As Integer = 0
Dim fila2 As Integer = 0
tabla.Rows.Clear()
tabla.AllowUserToAddRows = False
Do
sLine = objReader.ReadLine()
If Not sLine Is Nothing Then
If fila = 0 Then
tabla.ColumnCount = sLine.Split(caracter).Length
nombrarTitulo(tabla, sLine.Split(caracter))
fila += 1
Else
agregarFilaDatagridview(tabla, sLine, ";", fila2)
fila2 += 1
End If
End If
Loop Until sLine Is Nothing
objReader.Close()
End Sub
'Agregar el HeaderText al datagridview(SON LOS TITULOS)'
Sub nombrarTitulo(ByVal tabla As DataGridView, ByVal titulos() As String)
Dim x As Integer = 0
For x = 0 To tabla.ColumnCount - 1
tabla.Columns(x).HeaderText = titulos(x)
Next
End Sub
'Agrega una fila por cada linea de Bloc de notas :D'
Sub agregarFilaDatagridview(ByVal tabla As DataGridView, ByVal linea As String, ByVal caracter As String, ByVal fila As Integer)
Dim arreglo() As String = linea.Split(caracter)
tabla.ColumnCount = arreglo.Length
tabla.Rows.Add()
Dim x As Integer = 0
For x = 0 To tabla.ColumnCount - 1
tabla.Item(x, fila).Value = arreglo(x)
Next
End Sub