Hello,
I think I've been looking at this for too long, and can't see where the problem is.
I'm basically going through a folder, and adding file path and file name data to a DataGridView, along with a column to ask the user to confirm that they want to delete the file shown in the grid.
What I'm finding is that if I use the code as it is, I get something that is half-way what I need, but if I replace a couple of lines ...Code:For intCounter As Integer = 0 To strFiles.Length - 1 Me.prgFilesInFolderProgress.Value = intCounter txtFileName = strFiles(intCounter) dteFileCreated = Directory.GetCreationTime(strFiles(intCounter)).Date dteFileModified = Directory.GetLastWriteTime(strFiles(intCounter)).Date If (dteFileCreated.Date >= dteSelected And dteFileCreated.Date <= dteSelectedTo) Or _ (dteFileModified.Date >= dteSelected And dteFileModified.Date <= dteSelectedTo) Then If Me.DataGridView1.Visible = False Then Me.DataGridView1.Visible = True End If intDataGridRows += 1 Me.DataGridView1.Rows.Add() 'MsgBox("intDataGridRows = " & intDataGridRows.ToString & vbCrLf & _ ' "Rows in DataGridView = " & Me.DataGridView1.Rows.Count.ToString) Me.DataGridView1.Item(0, intCounter).Value = txtFileName Me.DataGridView1.Item(1, intCounter).Value = True End If Next
.... I get loads of blank rows, and the bottom row of the grid is the last file it encountered in the For .... Next loop.Code:Me.DataGridView1.Item(0, intDataGridRows).Value = txtFileName Me.DataGridView1.Item(1, intDataGridRows).Value = True




Reply With Quote