' WindowsAPICodePack をNuGet しておく Imports Microsoft.WindowsAPICodePack.Controls Imports Microsoft.WindowsAPICodePack.Controls.WindowsForms Imports Microsoft.WindowsAPICodePack.Shell Imports Microsoft.WindowsAPICodePack.Shell.PropertySystem Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load Dim pv = Me.ExplorerBrowser1.NavigationOptions.PaneVisibility pv.Navigation = PaneVisibilityState.Hide pv.Commands = PaneVisibilityState.Hide End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 'Dim searchString = Me.TextBox1.Text 'Dim sco = DirectCast(Me.ComboBox1.SelectedValue, SearchConditionOperation) Dim searchString = "*.log" Dim sco = SearchConditionOperation.DosWildcards Dim sc = SearchConditionFactory.CreateLeafCondition(SystemProperties.System.FileName, searchString, sco) Dim dir = ShellObject.FromParsingName(Environment.GetFolderPath(Environment.SpecialFolder.Windows)) Dim ssf As New ShellSearchFolder(sc, dir) Me.ExplorerBrowser1.Navigate(ssf) End Sub #If False Then '検索条件を TextBox / ComboBox から指定できるようにする場合はこちら Protected Overrides Sub OnLoad(e As EventArgs) MyBase.OnLoad(e) SetEnumToComboBox(Me.ComboBox1, SearchConditionOperation.DosWildcards) Me.TextBox1.Text = "*.log" End Sub ''' <summary> ''' 列挙型をコンボボックスに設定する ''' </summary> ''' <typeparam name="TEnum">C# と違って列挙型の型制約を書けないので値型制約で凌ぐ</typeparam> ''' <param name="comboBox">設定対象のコンボボックス</param> ''' <param name="defaultValue">初期設定させたい既定値</param> Private Sub SetEnumToComboBox(Of TEnum As Structure)(comboBox As ComboBox, Optional defaultValue As TEnum? = Nothing) Dim options = [Enum].GetValues(GetType(TEnum)) _ .OfType(Of TEnum)() _ .ToDictionary(Function(k) k.ToString(), Function(v) v) comboBox.DropDownStyle = ComboBoxStyle.DropDownList comboBox.DisplayMember = "Key" comboBox.ValueMember = "Value" comboBox.DataSource = New BindingSource(options, Nothing) If defaultValue IsNot Nothing Then comboBox.SelectedValue = defaultValue End If End Sub #End If End Class