Option Strict On Option Explicit On Imports System.Environment Public Class UserControlSpecialFolders Public Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. GetSpecialFolders() End Sub Dim folderList As New Dictionary(Of String, String) Private Sub GetSpecialFolders() Dim folderNames As String() = System.Enum.GetNames(GetType(Environment.SpecialFolder)) For Each folder As String In folderNames Dim lvi As New ListViewItem ' Alternate each items' background colour. If lstSpecialFolders.Items.Count Mod 2 <> 0 Then lvi.BackColor = Color.White Else lvi.BackColor = Color.Ivory End If folderList.Add(folder, GetFolderPath(CType(System.Enum.Parse(GetType(SpecialFolder), CType(folder, String)), SpecialFolder))) lvi.Text = folder lvi.SubItems.Add(folderList.Item(folder)) lstSpecialFolders.Items.Add(lvi) Next End Sub Public Sub CollectReportData() Dim newReport As TextReport = FormMain.TextReportFile For Each folderEntry As KeyValuePair(Of String, String) In folderList newReport.WriteItem(folderEntry.Key, folderEntry.Value) Next newReport.WriteSubtitle("") End Sub End Class
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)