Option Strict On Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Friend WithEvents DrivesList As System.Windows.Forms.ComboBox Friend WithEvents FoldersList As System.Windows.Forms.ListBox Friend WithEvents FilesList As System.Windows.Forms.ListBox 'Required by the Windows Form Designer Private components As System.ComponentModel.Container 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() Me.FoldersList = New System.Windows.Forms.ListBox() Me.FilesList = New System.Windows.Forms.ListBox() Me.DrivesList = New System.Windows.Forms.ComboBox() Me.SuspendLayout() ' 'FoldersList ' Me.FoldersList.Font = New System.Drawing.Font("Verdana", 9!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.FoldersList.ItemHeight = 14 Me.FoldersList.Location = New System.Drawing.Point(8, 36) Me.FoldersList.Name = "FoldersList" Me.FoldersList.Size = New System.Drawing.Size(216, 172) Me.FoldersList.TabIndex = 1 ' 'FilesList ' Me.FilesList.Font = New System.Drawing.Font("Verdana", 9!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.FilesList.ItemHeight = 14 Me.FilesList.Location = New System.Drawing.Point(232, 36) Me.FilesList.Name = "FilesList" Me.FilesList.Size = New System.Drawing.Size(272, 172) Me.FilesList.TabIndex = 2 ' 'DrivesList ' Me.DrivesList.DropDownWidth = 232 Me.DrivesList.Font = New System.Drawing.Font("Verdana", 9!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.DrivesList.Location = New System.Drawing.Point(8, 8) Me.DrivesList.Name = "DrivesList" Me.DrivesList.Size = New System.Drawing.Size(112, 22) Me.DrivesList.TabIndex = 0 Me.DrivesList.Text = "ComboBox1" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(512, 213) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.FilesList, Me.FoldersList, Me.DrivesList}) Me.Name = "Form1" Me.Text = "Custom Explorer" Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load ShowAllDrives() DrivesList.SelectedIndex = 1 Me.Text = Directory.GetCurrentDirectory End Sub Sub ShowAllDrives() Dim drives() As String drives = Directory.GetLogicalDrives() DrivesList.Items.Clear() 'Dim aDrive As String 'For Each aDrive In drives ' DrivesList.Items.Add(aDrive) 'Next DrivesList.Items.AddRange(drives) End Sub Sub ShowFolders(ByVal drive As String) Dim folders() As String Try folders = Directory.GetDirectories(drive) Catch exception As Exception MsgBox(exception.Message) Exit Sub End Try FoldersList.Items.Clear() FoldersList.Items.AddRange(New DirectoryInfo(drive).GetDirectories) Directory.SetCurrentDirectory(drive) Me.Text = Directory.GetCurrentDirectory End Sub Sub ShowFilesInFolder() FilesList.Items.Clear() FilesList.Items.AddRange(Directory.GetFiles(Directory.GetCurrentDirectory)) End Sub Private Sub DrivesList_SelectedIndexChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles DrivesList.SelectedIndexChanged ShowFolders(DrivesList.Text) End Sub Private Sub FoldersList_SelectedIndexChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles FoldersList.SelectedIndexChanged Dim DI As DirectoryInfo Select Case FoldersList.Text Case "" MsgBox("Please select a folder to expand") Exit Sub Case ".." Directory.SetCurrentDirectory("..") Case Else Directory.SetCurrentDirectory(FoldersList.Text) Me.Text = Directory.GetCurrentDirectory End Select Dim selectedFolder As String = FoldersList.Text Dim Dr As String = Directory.GetCurrentDirectory ShowFolders(Dr) If Dr <> Directory.GetDirectoryRoot(selectedFolder) Then _ FoldersList.Items.Insert(0, "..") ShowFilesInFolder() End Sub Private Sub FilesList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilesList.SelectedIndexChanged Dim FI As New FileInfo(FilesList.Text) Dim Msg As New System.Text.StringBuilder() Msg.Append("اسم الملفّ: " & FI.Name & vbCrLf) Msg.Append("الحجم: " & FI.Length.ToString & vbCrLf) Msg.Append("الامتداد: " & FI.Extension & vbCrLf) Msg.Append("وقت إنشائه: " & FI.CreationTime.ToString & vbCrLf) Msg.Append("وقت آخر قراءة: " & FI.LastAccessTime.ToShortDateString) MsgBox(Msg.ToString, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly Or MsgBoxStyle.MsgBoxRtlReading Or MsgBoxStyle.MsgBoxRight, "") End Sub End Class