i can make the listview box filled with files contains at the desktop
and i can make a new folder which suppose to be move the files on that folder
i have 3 problems:
1. is how to get last access time of the FILE and put it column2 of the listview
2. i want to view that are unused icon and document last week, 2weeks, 1month and 2months by selecting at the combobox
3. how to move checkeditems file in listbox to a folder?
i've been researching for 2 days and not posting a topic and now im frustrated
help me.. thanks in advance.
Expand|Select|Wrap|Line Numbers
- Imports System.Runtime.InteropServices 'For APIs
- Imports System.IO 'Import System.IO For File Operations
- Imports Microsoft.Win32 'The Registry stuff
- Imports System.Windows.Forms.Application
- Imports System
- 'TO view files inside the listbox
- Public Class Form1
- Private Filenames() As String
- Private Sub LoadFilenames()
- Dim Desktop As String = My.Computer.FileSystem.SpecialDirectories.Desktop.ToString()
- Dim FilePath As String
- Dim NumFiles As Integer
- Dim TruncName As String
- For Each FilePath In Directory.GetFiles(Desktop)
- TruncName = FilePath.Substring(FilePath.LastIndexOf("\") + 1) 'Remove Path From Name
- ListView1.Items.Add(TruncName)
- ReDim Preserve ScreenNames(NumFiles)
- FileNames(NumFiles) = FilePath
- NumFiles = NumFiles + 1 'Increment File Count
- Next
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- LoadFilenames()
- End Sub
- TO CREATE A FOLDER ON DESKTOP
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim Desktop As String = My.Computer.FileSystem.SpecialDirectories.Desktop
- If Not My.Computer.FileSystem.DirectoryExists(Desktop & "\Unused Desktop Icon and Documents") Then
- My.Computer.FileSystem.CreateDirectory(Desktop & "\Unused Desktop Icon and Documents")
- End If
- With Me.ListView1
- For i As Integer = 0 To .CheckedItems.Count - 1
- .Items.Remove(.CheckedItems(0))
- Next i
- End With
- ' If di.Exists Then
- ' Indicate that it already exists.
- ' MsgBox("That path exists already.")
- ' Else
- ' Try to create the directory.
- ' di.Create()
- ' End If
- 'TextBox1.Text = di.FullName
- End Sub