 
			
				13/09/2012, 18:30
			
			
			     |  
      |    |    |    Fecha de Ingreso: julio-2012  Ubicación: panama  
						Mensajes: 19
					  Antigüedad: 13 años, 3 meses Puntos: 0     |        |  
  |      Respuesta: Guardar txt modificado en un datagridview        Buenas noches amigos del foro les traigo algunos ajustes realizados a fin de pulir la aplicación. gracias al apoyo del amigo Dradi7 y Aquaventus sin embargo tengo la incertidunbre de porque al crear el archivo, al final me crea dos tab y si quiero volver a cargar el archivo creado no me lo permite si no le quito un tab. eh aqui los cambios realizados.   
Private Sub GuardarToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles GuardarToolStripMenuItem.Click   
        ' GENERANDO ALGUNAS VARIABLES UTILES 
        If File.Exists("c:\carpeta\archivo.DAT") Then 
            File.Delete("c:\carpeta\archivo.DAT") 
        End If   
        Const Dat As String = ("c:\carpeta\archivo.DAT") 
        ' GERENANDO EL ARCHIVO 
        Using f As New IO.StreamWriter(Dat, True)   
            ' AGREGANDO LAS COLUMNAS 
            Dim col As String = "" 
            ' AGREGANDO LAS FILAS 
            Dim row As String = "" 
            Dim i As Integer = 0 
            For Each r As DataGridViewRow In DataGridView1.Rows 
                For Each c As DataGridViewColumn In DataGridView1.Columns 
                    row = row & "'" & Convert.ToString(r.Cells(c.HeaderText).Value) & "' " 
                Next 
                If i < DataGridView1.Rows.Count - 1 Then row &= Environment.NewLine 
            Next   
            'AGREGANDO LA INFORMACION 
             f.WriteLine(row)   
        End Using   
    End Sub     
Saludos,           |