Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim dt As New DataTable
- dt.Columns.Add("Date")
- dt.Columns.Add("Gross Sales")
- Dim Folder As New IO.DirectoryInfo("c:test")
- Dim lstLines As New List(Of String)
- For Each fileentries As String In Folder.GetFiles("s*", IO.SearchOption.AllDirectories).OrderByDescending(Function(x) x.Name).Select(Function(x) x.FullName)
- lstLines.AddRange(File.ReadAllLines(fileentries))
- Next
- Dim i As Integer
- Dim OuterLoopIterations As Integer = CInt(lstLines.Count / 22)
- For iterations = 0 To OuterLoopIterations - 1
- Dim row = dt.NewRow
- For col = 0 To 21
- row(col) = lstLines(i).Remove(0, 2) 'i have removed the first 2 characters of each string
- i += 1
- Next
- dt.Rows.Add(row(2), row(5), row(12), row(13), row(14), row(15), row(7), row(8), row(11))
- Next
- DataGridView1.DataSource = dt
- 'the code i tried applying
- DataGridView1.Columns("Gross Sales").DefaultCellStyle.Format = "##,0"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement