VB.Net Tutorial/GUI Applications/File manager

Материал из VB Эксперт
Перейти к: навигация, поиск

File Explore

"Sams Teach Yourself Visual Basic .NET in 21 Days
"By Lowell Mauer
"Published 2001
"Sams Publishing
"ISBN 0672322714

Imports System.IO
Imports System.Windows.Forms
public class TreeViewFileFolder
   public Shared Sub Main
        Application.Run(New PioneerForm)
   End Sub
End class
Public Class PioneerForm
    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 tvwFolders As System.Windows.Forms.TreeView
    Friend WithEvents splView As System.Windows.Forms.Splitter
    Friend WithEvents lvwFiles As System.Windows.Forms.ListView
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.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.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.splView = New System.Windows.Forms.Splitter()
        Me.lvwFiles = New System.Windows.Forms.ListView()
        Me.tvwFolders = New System.Windows.Forms.TreeView()
        Me.SuspendLayout()
        "
        "splView
        "
        Me.splView.Location = New System.Drawing.Point(121, 0)
        Me.splView.Name = "splView"
        Me.splView.Size = New System.Drawing.Size(4, 327)
        Me.splView.TabIndex = 1
        Me.splView.TabStop = False
        "
        "lvwFiles
        "
        Me.lvwFiles.Dock = System.Windows.Forms.DockStyle.Fill
        Me.lvwFiles.Location = New System.Drawing.Point(125, 0)
        Me.lvwFiles.Name = "lvwFiles"
        Me.lvwFiles.Size = New System.Drawing.Size(333, 327)
        Me.lvwFiles.TabIndex = 2
        Me.lvwFiles.View = System.Windows.Forms.View.List
        "
        "tvwFolders
        "
        Me.tvwFolders.Dock = System.Windows.Forms.DockStyle.Left
        Me.tvwFolders.ImageIndex = -1
        Me.tvwFolders.Name = "tvwFolders"
        Me.tvwFolders.SelectedImageIndex = -1
        Me.tvwFolders.Size = New System.Drawing.Size(121, 327)
        Me.tvwFolders.TabIndex = 0
        "
        "PioneerForm
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(458, 327)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lvwFiles, Me.splView, Me.tvwFolders})
        Me.Name = "PioneerForm"
        Me.Text = "Pioneer"
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub PioneerForm_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
        Handles MyBase.Load
        "add drives to the treeview
        Dim sDrives() As String = Directory.GetLogicalDrives()
        Dim sDrive As String
        Dim tvwNode As TreeNode
        For Each sDrive In sDrives
            tvwNode = tvwFolders.Nodes.Add(sDrive)
            "add a dummy node
            tvwNode.Nodes.Add("dummy")
        Next
    End Sub
    Private Sub tvwFolders_BeforeExpand(ByVal sender As Object, _
        ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) _
        Handles tvwFolders.BeforeExpand
        "see if we already know what the children are
        "   (we don"t if there is still a dummy there)
        Dim oNode As TreeNode = CType(e.Node, TreeNode)
        If oNode.Nodes(0).Text = "dummy" Then
            "remove the dummy
            oNode.Nodes(0).Remove()
            "add the real children
            GetChildren(oNode)
        End If
    End Sub
    Private Sub tvwFolders_AfterSelect(ByVal sender As Object, _
        ByVal e As System.Windows.Forms.TreeViewEventArgs) _
        Handles tvwFolders.AfterSelect
        Dim sFiles() As String
        Try
            sFiles = Directory.GetFiles(tvwFolders.SelectedNode.FullPath)
        Catch ex As Exception
            "just ignore the exception
            "the most likely cause of the exception
            " is "Dive not ready" if you"re accessing a floppy
            " without a disc in the drive
        End Try
        If Not IsNothing(sFiles) then
            Dim sFile As String
            Dim oItem As ListViewItem
            lvwFiles.Items.Clear()
        End If
    End Sub
    Private Sub GetChildren(ByVal node As TreeNode)
        Dim sDirs() As String = Directory.GetDirectories(node.FullPath)
        Dim sDir As String
        Dim oNode As TreeNode
        For Each sDir In sDirs
            oNode = node.Nodes.Add(StripPath(sDir))
            "add a dummy node as a child
            oNode.Nodes.Add("dummy")
        Next
    End Sub
    Private Function StripPath(ByVal path As String) As String
        "removes the leading path from the filename
        Dim iPos As Integer
        "find the last \ character
        iPos = path.LastIndexOf("\")
        "everything after it is the actual filename
        Return path.Substring(iPos + 1)
    End Function
End Class

File Explore with file attribute

"Sams Teach Yourself Visual Basic .NET in 21 Days
"By Lowell Mauer
"Published 2001
"Sams Publishing
"ISBN 0672322714

Imports System.IO
Imports System.Windows.Forms
public class TreeViewFileFolderFileAttribute
   public Shared Sub Main
        Application.Run(New PioneerForm)
   End Sub
End class
Public Class PioneerForm
    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 tvwFolders As System.Windows.Forms.TreeView
    Friend WithEvents splView As System.Windows.Forms.Splitter
    Friend WithEvents lvwFiles As System.Windows.Forms.ListView
    Friend WithEvents hdrName As System.Windows.Forms.ColumnHeader
    Friend WithEvents hdrModified As System.Windows.Forms.ColumnHeader
    Friend WithEvents hdrAttributes As System.Windows.Forms.ColumnHeader
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.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.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.splView = New System.Windows.Forms.Splitter()
        Me.lvwFiles = New System.Windows.Forms.ListView()
        Me.tvwFolders = New System.Windows.Forms.TreeView()
        Me.hdrName = New System.Windows.Forms.ColumnHeader()
        Me.hdrAttributes = New System.Windows.Forms.ColumnHeader()
        Me.hdrModified = New System.Windows.Forms.ColumnHeader()
        Me.SuspendLayout()
        "
        "splView
        "
        Me.splView.Location = New System.Drawing.Point(121, 0)
        Me.splView.Name = "splView"
        Me.splView.Size = New System.Drawing.Size(4, 327)
        Me.splView.TabIndex = 1
        Me.splView.TabStop = False
        "
        "lvwFiles
        "
        Me.lvwFiles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.hdrName, Me.hdrAttributes, Me.hdrModified})
        Me.lvwFiles.Dock = System.Windows.Forms.DockStyle.Fill
        Me.lvwFiles.Location = New System.Drawing.Point(125, 0)
        Me.lvwFiles.Name = "lvwFiles"
        Me.lvwFiles.Size = New System.Drawing.Size(349, 327)
        Me.lvwFiles.TabIndex = 2
        Me.lvwFiles.View = System.Windows.Forms.View.Details
        "
        "tvwFolders
        "
        Me.tvwFolders.Dock = System.Windows.Forms.DockStyle.Left
        Me.tvwFolders.ImageIndex = -1
        Me.tvwFolders.Name = "tvwFolders"
        Me.tvwFolders.SelectedImageIndex = -1
        Me.tvwFolders.Size = New System.Drawing.Size(121, 327)
        Me.tvwFolders.TabIndex = 0
        "
        "hdrName
        "
        Me.hdrName.Text = "File Name"
        Me.hdrName.Width = 180
        "
        "hdrAttributes
        "
        Me.hdrAttributes.Text = "Attributes"
        Me.hdrAttributes.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        "
        "hdrModified
        "
        Me.hdrModified.Text = "Last Modified"
        Me.hdrModified.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        Me.hdrModified.Width = 80
        "
        "PioneerForm
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(474, 327)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lvwFiles, Me.splView, Me.tvwFolders})
        Me.Name = "PioneerForm"
        Me.Text = "Pioneer"
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub PioneerForm_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
        Handles MyBase.Load
        "add drives to the treeview
        Dim sDrives() As String = Directory.GetLogicalDrives()
        Dim sDrive As String
        Dim tvwNode As TreeNode
        For Each sDrive In sDrives
            tvwNode = tvwFolders.Nodes.Add(sDrive)
            "add a dummy node
            tvwNode.Nodes.Add("dummy")
        Next
    End Sub
    Private Sub tvwFolders_BeforeExpand(ByVal sender As Object, _
        ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) _
        Handles tvwFolders.BeforeExpand
        "see if we already know what the children are
        "   (we don"t if there is still a dummy there)
        Dim oNode As TreeNode = CType(e.Node, TreeNode)
        If oNode.Nodes(0).Text = "dummy" Then
            "remove the dummy
            oNode.Nodes(0).Remove()
            "add the real children
            GetChildren(oNode)
        End If
    End Sub
    Private Sub tvwFolders_AfterSelect(ByVal sender As Object, _
        ByVal e As System.Windows.Forms.TreeViewEventArgs) _
        Handles tvwFolders.AfterSelect
        Dim sFiles() As String = Directory.GetFiles(tvwFolders.SelectedNode.FullPath)
        Dim sFile As String
        Dim oItem As ListViewItem
        lvwFiles.Items.Clear()
        For Each sFile In sFiles
            oItem = lvwFiles.Items.Add(StripPath(sFile))
            If lvwFiles.Items.Count > 0 Then
                oItem.SubItems.Add(GetAttributeString(sFile))
                oItem.SubItems.Add(File.GetLastWriteTime(sFile))
            End If
        Next
    End Sub
    Private Sub GetChildren(ByVal node As TreeNode)
        Dim sDirs() As String = Directory.GetDirectories(node.FullPath)
        Dim sDir As String
        Dim oNode As TreeNode
        For Each sDir In sDirs
            oNode = node.Nodes.Add(StripPath(sDir))
            "add a dummy node as a child
            oNode.Nodes.Add("dummy")
        Next
    End Sub
    Private Function GetAttributeString(ByVal fileName As String) As String
        Dim sReturn As String
        Dim oAttr As FileAttributes = File.GetAttributes(fileName)
        If (oAttr And FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
            sReturn = "R"
        Else
            sReturn = "-"
        End If
        If (oAttr And FileAttributes.Hidden) = FileAttributes.Hidden Then
            sReturn += "H"
        Else
            sReturn += "-"
        End If
        If (oAttr And FileAttributes.System) = FileAttributes.System Then
            sReturn += "S"
        Else
            sReturn += "-"
        End If
        Return sReturn
    End Function
    Private Function StripPath(ByVal path As String) As String
        "removes the leading path from the filename
        Dim iPos As Integer
        "find the last \ character
        iPos = path.LastIndexOf("\")
        "everything after it is the actual filename
        Return path.Substring(iPos + 1)
    End Function
End Class

File manager

"Visual Basic.Net JingCai Programming 100 Examples
"Author: Yong Zhang
"Publisher: Water Publisher China
"ISBN: 750841156
Imports System.Runtime.InteropServices
Imports System.IO
Imports System.Collections
Imports System.Windows.Forms
public class FileManager
   public Shared Sub Main
        Application.Run(New MainForm)
   End Sub
End class

Public Class MainForm
    Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Integer
    Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" _
    (ByVal lpDirectoryName As String, _
    ByRef lpFreeBytesAvailableToCaller As Long, _
    ByRef lpTotalNumberOfBytes As Long, _
    ByRef lpTotalNumberOfFreeBytes As Long) As Long
    Dim nDirLevel As Integer
    Private Sub ListDrives()
        Dim tn As TreeNode
        Dim drives() As String = Directory.GetLogicalDrives()
        tvDir.BeginUpdate()
        Dim i As Integer
        For i = 0 To drives.Length - 1
            Select Case GetDriveType(drives(i))
                Case 2 "Flooy disk
                    tn = New TreeNode(drives(i), 0, 0)
                Case 3 "" Dard drive
                    tn = New TreeNode(drives(i), 1, 1)
                    ListDirs(tn, drives(i)) 
                Case 5 "DVD
                    tn = New TreeNode(drives(i), 2, 2)
                Case Else "
                    tn = New TreeNode(drives(i), 0, 0)
            End Select
            tvDir.Nodes.Add(tn)
        Next i
        tvDir.EndUpdate()
        tvDir.SelectedNode = tvDir.Nodes(1)
    End Sub
    Private Sub ListDirs(ByVal tn As TreeNode, ByVal strDir As String)
        If nDirLevel > 2 Then   "Level
            nDirLevel = 0
            Exit Sub
        End If
        nDirLevel += 1
        Dim arrDirs() As String
        Dim tmpNode As TreeNode
        Try
            arrDirs = Directory.GetDirectories(strDir)
            If arrDirs.Length = 0 Then Exit Sub
            Dim i As Integer
            For i = 0 To arrDirs.Length - 1
                tmpNode = New TreeNode(Path.GetFileName(arrDirs(i)), 3, 4)
                ListDirs(tmpNode, arrDirs(i))
                tn.Nodes.Add(tmpNode)
            Next i
        Catch
            Exit Sub
        End Try
    End Sub
    Private Sub ListDirsAndFiles(ByVal strDir As String)
        Dim lvi As ListViewItem
        Dim nImgIndex As Integer
        Dim items(4) As String
        Dim dirs() As String
        Dim files() As String
        Try
            dirs = Directory.GetDirectories(strDir)
            files = Directory.GetFiles(strDir)
        Catch
            Exit Sub
        End Try
        lvFiles.BeginUpdate()
        lvFiles.Clear()
        lvFiles.Columns.AddRange( _
        New System.Windows.Forms.ColumnHeader() {chName, chSize, chType, chTime})
        Dim i As Integer
        For i = 0 To dirs.Length - 1
            items(0) = Path.GetFileName(dirs(i))
            items(1) = ""
            items(2) = "Folder"
            items(3) = Directory.GetLastWriteTime(dirs(i)).ToLongDateString() + " " + Directory.GetLastWriteTime(dirs(i)).ToLongTimeString()
            lvi = New ListViewItem(items, 3)
            lvFiles.Items.Add(lvi)
        Next i
        For i = 0 To files.Length - 1
            Dim ext As String = (Path.GetExtension(files(i))).ToLower()
            If (ext = ".txt") Then
                nImgIndex = 5
            ElseIf (ext = ".bmp") Then
                nImgIndex = 6
            ElseIf (ext = ".hlp") Then
                nImgIndex = 7
            ElseIf (ext = ".exe") Then
                nImgIndex = 8
            Else
                nImgIndex = 9
            End If
            items(0) = Path.GetFileName(files(i))
            Dim fi As FileInfo = New FileInfo(files(i))
            items(1) = fi.Length.ToString()
            items(2) = ext + "File"
            items(3) = fi.LastWriteTime.ToLongDateString() + "  " + fi.LastWriteTime.ToLongTimeString()
            lvi = New ListViewItem(items, nImgIndex)
            lvFiles.Items.Add(lvi)
        Next i
        lvFiles.EndUpdate()
    End Sub
    Private Sub OpenFile()
        If lvFiles.SelectedItems.Count <= 0 Then
            MessageBox.Show(Me, "Open file", "File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Exit Sub
        End If
        Dim lvi As ListViewItem = lvFiles.SelectedItems(0)
        If ((Path.GetExtension(lvi.Text)).ToLower() <> ".txt") Then
            MessageBox.Show(Me, "Text file only", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return
        End If
        Dim FileForm As ContentForm = New ContentForm()
        FileForm.Text = lvi.Text
        Dim filename As String = tvDir.SelectedNode.FullPath + "\" + lvFiles.SelectedItems(0).Text
        Dim sr As StreamReader = New StreamReader(filename)
        Dim lines As ArrayList = New ArrayList()
        Do While (sr.Peek() <> -1)
            lines.Add(sr.ReadLine())
        Loop
        FileForm.txtContent.Lines = lines.ToArray(Type.GetType("System.String"))
        sr.Close()
        FileForm.txtContent.Select(0, 0)
        FileForm.ShowDialog(Me) 
    End Sub
    Private Sub NewFile()
        Dim formFileName As InputFileName = New InputFileName()
        If formFileName.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK Then
            Dim filename As String = tvDir.SelectedNode.FullPath + "\" + formFileName.txtFileName.Text + ".txt"
            Dim sw As StreamWriter = New StreamWriter(filename)
            If (sw IsNot Nothing) Then
                sw.Write("")
                sw.Close()
                ListDirsAndFiles(tvDir.SelectedNode.FullPath)
            End If
        End If
    End Sub
    Private Sub DeleteFile()
        If (lvFiles.SelectedItems.Count <= 0) Then
            MessageBox.Show(Me, "Delete file", "File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return
        End If
        Dim filename As String = tvDir.SelectedNode.FullPath + "\" + lvFiles.SelectedItems(0).Text
        If (lvFiles.SelectedItems(0).ImageIndex = 3) Then
            MessageBox.Show(Me, "Not a file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return
        Else
            File.Delete(filename)
        End If
        ListDirsAndFiles(tvDir.SelectedNode.FullPath)
    End Sub
    Private Sub NewDirectory()
        Dim formdir As InputFileName = New InputFileName()
        formdir.Text = "Name"
        formdir.label1.Text = "Name"
        If (formdir.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Directory.CreateDirectory(tvDir.SelectedNode.FullPath + "\" + formdir.txtFileName.Text)
            tvDir.SelectedNode.Nodes.Add(New TreeNode(formdir.txtFileName.Text, 3, 4))
        End If
    End Sub
    Private Sub DeleteDirectory()
        If (MessageBox.Show(Me, "Delete it" + tvDir.SelectedNode.FullPath, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) = System.Windows.Forms.DialogResult.OK) Then
            Directory.Delete(tvDir.SelectedNode.FullPath, True)
            tvDir.SelectedNode.Remove()
        End If
    End Sub
    Private Sub ChangeListViewMode(ByVal newview As View)
        miLargeIcon.Checked = False
        miSmallIcon.Checked = False
        miList.Checked = False
        miDetail.Checked = False
        tsbLargeIcon.Checked = False
        tsbSmallIcon.Checked = False
        tsbList.Checked = False
        tsbDetail.Checked = False
        Select Case newview
            Case View.LargeIcon
                lvFiles.View = View.LargeIcon
                tsbLargeIcon.Checked = True
                miLargeIcon.Checked = True
            Case View.SmallIcon
                lvFiles.View = View.SmallIcon
                tsbSmallIcon.Checked = True
                miSmallIcon.Checked = True
            Case View.List
                lvFiles.View = View.List
                tsbList.Checked = True
                miList.Checked = True
            Case Else
                lvFiles.View = View.Details
                tsbDetail.Checked = True
                miDetail.Checked = True
        End Select
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        nDirLevel = 0       
        ListDrives()        
    End Sub
    Private Sub miNewFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miNewFile.Click, tsbNew.Click
        NewFile()
    End Sub
    Private Sub miDelFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miDelFile.Click, tsbDel.Click
        DeleteFile()
    End Sub
    Private Sub miOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miOpenFile.Click, tsbOpen.Click
        OpenFile()
    End Sub
    Private Sub miExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miExit.Click
        Me.Close()
    End Sub
    Private Sub miNewDir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miNewDir.Click
        NewDirectory()
    End Sub
    Private Sub miDelDir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miDelDir.Click
        DeleteDirectory()
    End Sub
    Private Sub miLargeIcon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miLargeIcon.Click, tsbLargeIcon.Click
        ChangeListViewMode(View.LargeIcon)
    End Sub
    Private Sub miSmallIcon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miSmallIcon.Click, tsbSmallIcon.Click
        ChangeListViewMode(View.SmallIcon)
    End Sub
    Private Sub miList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miList.Click, tsbList.Click
        ChangeListViewMode(View.List)
    End Sub
    Private Sub miDetail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miDetail.Click, tsbDetail.Click
        ChangeListViewMode(View.Details)
    End Sub
    Private Sub tvDir_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvDir.AfterSelect
        Dim callerfree As Long = 0
        Dim disksize As Long = 0
        Dim freespace As Long = 0
        txtPath.Text = tvDir.SelectedNode.FullPath
        ListDirsAndFiles(tvDir.SelectedNode.FullPath)
        GetDiskFreeSpaceEx(Path.GetPathRoot(tvDir.SelectedNode.FullPath), callerfree, disksize, freespace)
        freespace /= 1000000
        sb.Text = lvFiles.Items.Count.ToString() + freespace.ToString() + "MB"
    End Sub
    Private Sub lvFiles_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvFiles.DoubleClick
        Dim lvi As ListViewItem = lvFiles.SelectedItems(0)
        If (lvi.ImageIndex = 3) Then
            Dim tn As TreeNode = tvDir.SelectedNode
            Dim i As Integer
            For i = 0 To tn.Nodes.Count - 1
                If (String.rupare(tn.Nodes(i).Text, lvi.Text) = 0) Then
                    tvDir.SelectedNode = tn.Nodes(i)
                End If
            Next i
            Return
        End If
        OpenFile()
    End Sub
End Class

<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _
Partial Class MainForm
    Inherits System.Windows.Forms.Form
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub
    Private components As System.ruponentModel.IContainer
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.ruponents = New System.ruponentModel.Container
        Me.sb = New System.Windows.Forms.ToolStripStatusLabel
        Me.statusStrip1 = New System.Windows.Forms.StatusStrip
        Me.txtPath = New System.Windows.Forms.TextBox
        Me.panel1 = New System.Windows.Forms.Panel
        Me.label1 = New System.Windows.Forms.Label
        Me.tsbDetail = New System.Windows.Forms.ToolStripButton
        Me.tsbSmallIcon = New System.Windows.Forms.ToolStripButton
        Me.tsbLargeIcon = New System.Windows.Forms.ToolStripButton
        Me.toolStrip1 = New System.Windows.Forms.ToolStrip
        Me.tsbNew = New System.Windows.Forms.ToolStripButton
        Me.tsbOpen = New System.Windows.Forms.ToolStripButton
        Me.tsbDel = New System.Windows.Forms.ToolStripButton
        Me.tsbList = New System.Windows.Forms.ToolStripButton
        Me.panel2 = New System.Windows.Forms.Panel
        Me.splitter1 = New System.Windows.Forms.Splitter
        Me.lvFiles = New System.Windows.Forms.ListView
        Me.chName = New System.Windows.Forms.ColumnHeader
        Me.chSize = New System.Windows.Forms.ColumnHeader
        Me.chType = New System.Windows.Forms.ColumnHeader
        Me.chTime = New System.Windows.Forms.ColumnHeader
        Me.imgListView = New System.Windows.Forms.ImageList(Me.ruponents)
        Me.tvDir = New System.Windows.Forms.TreeView
        Me.miExit = New System.Windows.Forms.ToolStripMenuItem
        Me.miSep = New System.Windows.Forms.ToolStripSeparator
        Me.miNewDir = New System.Windows.Forms.ToolStripMenuItem
        Me.miDir = New System.Windows.Forms.ToolStripMenuItem
        Me.miDelDir = New System.Windows.Forms.ToolStripMenuItem
        Me.miDelFile = New System.Windows.Forms.ToolStripMenuItem
        Me.miFile = New System.Windows.Forms.ToolStripMenuItem
        Me.miNewFile = New System.Windows.Forms.ToolStripMenuItem
        Me.miOpenFile = New System.Windows.Forms.ToolStripMenuItem
        Me.menuStrip1 = New System.Windows.Forms.MenuStrip
        Me.miView = New System.Windows.Forms.ToolStripMenuItem
        Me.miLargeIcon = New System.Windows.Forms.ToolStripMenuItem
        Me.miSmallIcon = New System.Windows.Forms.ToolStripMenuItem
        Me.miList = New System.Windows.Forms.ToolStripMenuItem
        Me.miDetail = New System.Windows.Forms.ToolStripMenuItem
        Me.statusStrip1.SuspendLayout()
        Me.panel1.SuspendLayout()
        Me.toolStrip1.SuspendLayout()
        Me.panel2.SuspendLayout()
        Me.menuStrip1.SuspendLayout()
        Me.SuspendLayout()
        "
        "sb
        "
        Me.sb.Name = "sb"
        Me.sb.Size = New System.Drawing.Size(175, 17)
        Me.sb.Text = "toolStripStatusLabel1"
        "
        "statusStrip1
        "
        Me.statusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.sb})
        Me.statusStrip1.Location = New System.Drawing.Point(0, 454)
        Me.statusStrip1.Name = "statusStrip1"
        Me.statusStrip1.Size = New System.Drawing.Size(659, 22)
        Me.statusStrip1.TabIndex = 13
        Me.statusStrip1.Text = "statusStrip1"
        "
        "txtPath
        "
        Me.txtPath.Dock = System.Windows.Forms.DockStyle.Fill
        Me.txtPath.Location = New System.Drawing.Point(64, 0)
        Me.txtPath.Name = "txtPath"
        Me.txtPath.Size = New System.Drawing.Size(595, 25)
        Me.txtPath.TabIndex = 1
        "
        "panel1
        "
        Me.panel1.Controls.Add(Me.txtPath)
        Me.panel1.Controls.Add(Me.label1)
        Me.panel1.Dock = System.Windows.Forms.DockStyle.Top
        Me.panel1.Location = New System.Drawing.Point(0, 49)
        Me.panel1.Name = "panel1"
        Me.panel1.Size = New System.Drawing.Size(659, 29)
        Me.panel1.TabIndex = 14
        "
        "label1
        "
        Me.label1.Dock = System.Windows.Forms.DockStyle.Left
        Me.label1.Location = New System.Drawing.Point(0, 0)
        Me.label1.Name = "label1"
        Me.label1.Size = New System.Drawing.Size(64, 29)
        Me.label1.TabIndex = 0
        Me.label1.Text = "Path:"
        Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        "
        "tsbDetail
        "
        Me.tsbDetail.Checked = True
        Me.tsbDetail.CheckState = System.Windows.Forms.CheckState.Checked
        Me.tsbDetail.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.tsbDetail.ImageTransparentColor = System.Drawing.Color.Silver
        Me.tsbDetail.Name = "tsbDetail"
        Me.tsbDetail.Size = New System.Drawing.Size(23, 22)
        Me.tsbDetail.Text = "toolStripButton7"
        "
        "tsbSmallIcon
        "
        Me.tsbSmallIcon.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.tsbSmallIcon.ImageTransparentColor = System.Drawing.Color.Silver
        Me.tsbSmallIcon.Name = "tsbSmallIcon"
        Me.tsbSmallIcon.Size = New System.Drawing.Size(23, 22)
        Me.tsbSmallIcon.Text = "toolStripButton5"
        "
        "tsbLargeIcon
        "
        Me.tsbLargeIcon.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.tsbLargeIcon.ImageTransparentColor = System.Drawing.Color.Silver
        Me.tsbLargeIcon.Name = "tsbLargeIcon"
        Me.tsbLargeIcon.Size = New System.Drawing.Size(23, 22)
        Me.tsbLargeIcon.Text = "toolStripButton4"
        "
        "toolStrip1
        "
        Me.toolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsbNew, Me.tsbOpen, Me.tsbDel, Me.tsbLargeIcon, Me.tsbSmallIcon, Me.tsbList, Me.tsbDetail})
        Me.toolStrip1.Location = New System.Drawing.Point(0, 24)
        Me.toolStrip1.Name = "toolStrip1"
        Me.toolStrip1.Size = New System.Drawing.Size(659, 25)
        Me.toolStrip1.TabIndex = 12
        Me.toolStrip1.Text = "toolStrip1"
        "
        "tsbNew
        "
        Me.tsbNew.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.tsbNew.ImageTransparentColor = System.Drawing.Color.Silver
        Me.tsbNew.Name = "tsbNew"
        Me.tsbNew.Size = New System.Drawing.Size(23, 22)
        Me.tsbNew.Text = "toolStripButton1"
        "
        "tsbOpen
        "
        Me.tsbOpen.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.tsbOpen.ImageTransparentColor = System.Drawing.Color.Silver
        Me.tsbOpen.Name = "tsbOpen"
        Me.tsbOpen.Size = New System.Drawing.Size(23, 22)
        Me.tsbOpen.Text = "toolStripButton2"
        "
        "tsbDel
        "
        Me.tsbDel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.tsbDel.ImageTransparentColor = System.Drawing.Color.Silver
        Me.tsbDel.Name = "tsbDel"
        Me.tsbDel.Size = New System.Drawing.Size(23, 22)
        Me.tsbDel.Text = "toolStripButton3"
        "
        "tsbList
        "
        Me.tsbList.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.tsbList.ImageTransparentColor = System.Drawing.Color.Silver
        Me.tsbList.Name = "tsbList"
        Me.tsbList.Size = New System.Drawing.Size(23, 22)
        Me.tsbList.Text = "toolStripButton6"
        "
        "panel2
        "
        Me.panel2.Controls.Add(Me.splitter1)
        Me.panel2.Controls.Add(Me.lvFiles)
        Me.panel2.Controls.Add(Me.tvDir)
        Me.panel2.Dock = System.Windows.Forms.DockStyle.Fill
        Me.panel2.Location = New System.Drawing.Point(0, 78)
        Me.panel2.Name = "panel2"
        Me.panel2.Size = New System.Drawing.Size(659, 398)
        Me.panel2.TabIndex = 15
        "
        "splitter1
        "
        Me.splitter1.Location = New System.Drawing.Point(201, 0)
        Me.splitter1.Name = "splitter1"
        Me.splitter1.Size = New System.Drawing.Size(3, 398)
        Me.splitter1.TabIndex = 5
        Me.splitter1.TabStop = False
        "
        "lvFiles
        "
        Me.lvFiles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.chName, Me.chSize, Me.chType, Me.chTime})
        Me.lvFiles.Dock = System.Windows.Forms.DockStyle.Fill
        Me.lvFiles.LargeImageList = Me.imgListView
        Me.lvFiles.Location = New System.Drawing.Point(201, 0)
        Me.lvFiles.Name = "lvFiles"
        Me.lvFiles.Size = New System.Drawing.Size(458, 398)
        Me.lvFiles.SmallImageList = Me.imgListView
        Me.lvFiles.StateImageList = Me.imgListView
        Me.lvFiles.TabIndex = 4
        Me.lvFiles.UseCompatibleStateImageBehavior = False
        "
        "chName
        "
        Me.chName.Text = "Name"
        Me.chName.Width = 200
        "
        "chSize
        "
        Me.chSize.Text = "Size"
        Me.chSize.Width = 100
        "
        "chType
        "
        Me.chType.Text = "Type"
        Me.chType.Width = 120
        "
        "chTime
        "
        Me.chTime.Text = "Date"
        Me.chTime.Width = 200
        "
        "tvDir
        "
        Me.tvDir.Dock = System.Windows.Forms.DockStyle.Left
        Me.tvDir.Location = New System.Drawing.Point(0, 0)
        Me.tvDir.Name = "tvDir"
        Me.tvDir.Size = New System.Drawing.Size(201, 398)
        Me.tvDir.TabIndex = 3
        "
        "miExit
        "
        Me.miExit.Name = "miExit"
        Me.miExit.Size = New System.Drawing.Size(128, 22)
        Me.miExit.Text = "Exit"
        "
        "miSep
        "
        Me.miSep.Name = "miSep"
        Me.miSep.Size = New System.Drawing.Size(125, 6)
        "
        "miNewDir
        "
        Me.miNewDir.Name = "miNewDir"
        Me.miNewDir.Size = New System.Drawing.Size(128, 22)
        Me.miNewDir.Text = "New(&N)"
        "
        "miDir
        "
        Me.miDir.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.miNewDir, Me.miDelDir})
        Me.miDir.Name = "miDir"
        Me.miDir.Size = New System.Drawing.Size(73, 20)
        Me.miDir.Text = "Dir(&D)"
        "
        "miDelDir
        "
        Me.miDelDir.Name = "miDelDir"
        Me.miDelDir.Size = New System.Drawing.Size(128, 22)
        Me.miDelDir.Text = "Delete(&D)"
        "
        "miDelFile
        "
        Me.miDelFile.Name = "miDelFile"
        Me.miDelFile.Size = New System.Drawing.Size(128, 22)
        Me.miDelFile.Text = "Delete(&D)"
        "
        "miFile
        "
        Me.miFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.miNewFile, Me.miOpenFile, Me.miDelFile, Me.miSep, Me.miExit})
        Me.miFile.Name = "miFile"
        Me.miFile.Size = New System.Drawing.Size(73, 20)
        Me.miFile.Text = "File(&F)"
        "
        "miNewFile
        "
        Me.miNewFile.Name = "miNewFile"
        Me.miNewFile.Size = New System.Drawing.Size(128, 22)
        Me.miNewFile.Text = "New(&N)"
        "
        "miOpenFile
        "
        Me.miOpenFile.Name = "miOpenFile"
        Me.miOpenFile.Size = New System.Drawing.Size(128, 22)
        Me.miOpenFile.Text = "Open(&O)"
        "
        "menuStrip1
        "
        Me.menuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.miFile, Me.miDir, Me.miView})
        Me.menuStrip1.Location = New System.Drawing.Point(0, 0)
        Me.menuStrip1.Name = "menuStrip1"
        Me.menuStrip1.Size = New System.Drawing.Size(659, 24)
        Me.menuStrip1.TabIndex = 11
        Me.menuStrip1.Text = "menuStrip1"
        "
        "miView
        "
        Me.miView.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.miLargeIcon, Me.miSmallIcon, Me.miList, Me.miDetail})
        Me.miView.Name = "miView"
        Me.miView.Size = New System.Drawing.Size(73, 20)
        Me.miView.Text = "View(&V)"
        "
        "miLargeIcon
        "
        Me.miLargeIcon.Name = "miLargeIcon"
        Me.miLargeIcon.Size = New System.Drawing.Size(158, 22)
        Me.miLargeIcon.Text = "Large Icon(&L)"
        "
        "miSmallIcon
        "
        Me.miSmallIcon.Name = "miSmallIcon"
        Me.miSmallIcon.Size = New System.Drawing.Size(158, 22)
        Me.miSmallIcon.Text = "Small Icon(&S)"
        "
        "miList
        "
        Me.miList.Name = "miList"
        Me.miList.Size = New System.Drawing.Size(158, 22)
        Me.miList.Text = "List(&L)"
        "
        "miDetail
        "
        Me.miDetail.Name = "miDetail"
        Me.miDetail.Size = New System.Drawing.Size(158, 22)
        Me.miDetail.Text = "Detail(&D)"
        "
        "MainForm
        "
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(659, 476)
        Me.Controls.Add(Me.statusStrip1)
        Me.Controls.Add(Me.panel2)
        Me.Controls.Add(Me.panel1)
        Me.Controls.Add(Me.toolStrip1)
        Me.Controls.Add(Me.menuStrip1)
        Me.statusStrip1.ResumeLayout(False)
        Me.statusStrip1.PerformLayout()
        Me.panel1.ResumeLayout(False)
        Me.panel1.PerformLayout()
        Me.toolStrip1.ResumeLayout(False)
        Me.toolStrip1.PerformLayout()
        Me.panel2.ResumeLayout(False)
        Me.menuStrip1.ResumeLayout(False)
        Me.menuStrip1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()
    End Sub
    Private WithEvents sb As System.Windows.Forms.ToolStripStatusLabel
    Private WithEvents statusStrip1 As System.Windows.Forms.StatusStrip
    Private WithEvents txtPath As System.Windows.Forms.TextBox
    Private WithEvents panel1 As System.Windows.Forms.Panel
    Private WithEvents label1 As System.Windows.Forms.Label
    Private WithEvents tsbDetail As System.Windows.Forms.ToolStripButton
    Private WithEvents tsbSmallIcon As System.Windows.Forms.ToolStripButton
    Private WithEvents tsbLargeIcon As System.Windows.Forms.ToolStripButton
    Private WithEvents toolStrip1 As System.Windows.Forms.ToolStrip
    Private WithEvents tsbNew As System.Windows.Forms.ToolStripButton
    Private WithEvents tsbOpen As System.Windows.Forms.ToolStripButton
    Private WithEvents tsbDel As System.Windows.Forms.ToolStripButton
    Private WithEvents tsbList As System.Windows.Forms.ToolStripButton
    Private WithEvents panel2 As System.Windows.Forms.Panel
    Private WithEvents splitter1 As System.Windows.Forms.Splitter
    Private WithEvents lvFiles As System.Windows.Forms.ListView
    Private WithEvents chName As System.Windows.Forms.ColumnHeader
    Private WithEvents chSize As System.Windows.Forms.ColumnHeader
    Private WithEvents chType As System.Windows.Forms.ColumnHeader
    Private WithEvents chTime As System.Windows.Forms.ColumnHeader
    Private WithEvents imgListView As System.Windows.Forms.ImageList
    Private WithEvents tvDir As System.Windows.Forms.TreeView
    Private WithEvents miExit As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miSep As System.Windows.Forms.ToolStripSeparator
    Private WithEvents miNewDir As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miDir As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miDelDir As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miDelFile As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miFile As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miNewFile As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miOpenFile As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents menuStrip1 As System.Windows.Forms.MenuStrip
    Private WithEvents miView As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miLargeIcon As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miSmallIcon As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miList As System.Windows.Forms.ToolStripMenuItem
    Private WithEvents miDetail As System.Windows.Forms.ToolStripMenuItem
End Class

<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _
Partial Class ContentForm
    Inherits System.Windows.Forms.Form
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub
    Private components As System.ruponentModel.IContainer
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.txtContent = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        "
        "txtContent
        "
        Me.txtContent.Dock = System.Windows.Forms.DockStyle.Fill
        Me.txtContent.Location = New System.Drawing.Point(0, 0)
        Me.txtContent.Multiline = True
        Me.txtContent.Name = "txtContent"
        Me.txtContent.ScrollBars = System.Windows.Forms.ScrollBars.Both
        Me.txtContent.Size = New System.Drawing.Size(632, 403)
        Me.txtContent.TabIndex = 2
        Me.txtContent.Text = "textBox1"
        "
        "ContentForm
        "
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(632, 403)
        Me.Controls.Add(Me.txtContent)
        Me.Name = "ContentForm"
        Me.Text = "ContentForm"
        Me.ResumeLayout(False)
        Me.PerformLayout()
    End Sub
    Public WithEvents txtContent As System.Windows.Forms.TextBox
End Class

<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _
Partial Class InputFileName
    Inherits System.Windows.Forms.Form
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub
    Private components As System.ruponentModel.IContainer
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.btnCancel = New System.Windows.Forms.Button
        Me.btnOK = New System.Windows.Forms.Button
        Me.txtFileName = New System.Windows.Forms.TextBox
        Me.label1 = New System.Windows.Forms.Label
        Me.SuspendLayout()
        "
        "btnCancel
        "
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(265, 119)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(100, 30)
        Me.btnCancel.TabIndex = 11
        Me.btnCancel.Text = "Cancel(&C)"
        "
        "btnOK
        "
        Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnOK.Location = New System.Drawing.Point(63, 119)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(100, 30)
        Me.btnOK.TabIndex = 10
        Me.btnOK.Text = "OK(&O)"
        "
        "txtFileName
        "
        Me.txtFileName.Location = New System.Drawing.Point(28, 51)
        Me.txtFileName.Name = "txtFileName"
        Me.txtFileName.Size = New System.Drawing.Size(394, 25)
        Me.txtFileName.TabIndex = 9
        "
        "label1
        "
        Me.label1.Location = New System.Drawing.Point(25, 19)
        Me.label1.Name = "label1"
        Me.label1.Size = New System.Drawing.Size(320, 29)
        Me.label1.TabIndex = 8
        Me.label1.Text = "File Name without extension name"
        "
        "InputFileName
        "
        Me.AcceptButton = Me.btnOK
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(446, 172)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnOK)
        Me.Controls.Add(Me.txtFileName)
        Me.Controls.Add(Me.label1)
        Me.ResumeLayout(False)
        Me.PerformLayout()
    End Sub
    Private WithEvents btnCancel As System.Windows.Forms.Button
    Private WithEvents btnOK As System.Windows.Forms.Button
    Public WithEvents txtFileName As System.Windows.Forms.TextBox
    Public WithEvents label1 As System.Windows.Forms.Label
End Class