Bonjour,
Je cherche comment remplir les données d'un mon fichier texte dans une datagridview
a partir de ce code de sauvegarde
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Using Dilaoge As New SaveFileDialog
          Dilaoge.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
          If Dilaoge.ShowDialog() = Windows.Forms.DialogResult.OK Then
              Dim NomFechiers As String = Dilaoge.FileName
              Dim SW As StreamWriter = File.CreateText(NomFechiers)
              Dim total = (From x As DataGridViewRow In DGView.Rows Select CDbl(x.Cells(4).Value)).Sum
              SW.WriteLine("" & DGView.RowCount & "" & Today.ToLongDateString & "" & FormatNumber(total))
              Dim C1, C2, C3, C4 As String
              For i As Integer = 0 To DGView.Rows.Count - 1
                  C2 = (DGView.Rows(i).Cells(2).Value.ToString().PadLeft(5, "0") & "")
                  C3 = (DGView.Rows(i).Cells(3).Value.ToString() & "")
                  C4 = (DGView.Rows(i).Cells(4).Value.ToString() & "")
                  C1 = (DGView.Rows(i).Cells(1).Value.ToString().PadLeft(27))
                  SW.Write(C2 & "" & C3 & "" & GetFormatNumber(C4) & "" & C1)
                  SW.WriteLine("")
              Next
              SW.Close()
              MessageBox.Show("saved")
          End If
      End Using