VB.Net by API/System.Windows.Forms/FolderBrowserDialog — различия между версиями

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

Текущая версия на 12:52, 26 мая 2010

FolderBrowserDialog.Description

  
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Public Class MainClass
    
    Shared Sub Main()
        Dim dlgFolder As System.Windows.Forms.FolderBrowserDialog
        dlgFolder = New System.Windows.Forms.FolderBrowserDialog

        dlgFolder.Description = "Select the folder that contains the XML files."
        If dlgFolder.ShowDialog() = DialogResult.OK Then
            Console.WriteLine( dlgFolder.SelectedPath)
        End If
    End Sub
End Class


FolderBrowserDialog.RootFolder

  
Imports System
Imports System.Collections
Imports System.ruponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.IO
Imports System.Drawing.Printing

Public Class MainClass
    Shared Sub Main()
        "Declare a FolderBrowserDialog object
        Dim objFolderBrowserDialog As New FolderBrowserDialog
        "Set the FolderBrowserDialog control properties
        objFolderBrowserDialog.Description = "Select your favorite folder:"
        objFolderBrowserDialog.RootFolder = Environment.SpecialFolder.Personal
        objFolderBrowserDialog.ShowNewFolderButton = True
        "Show the Browse For Folder dialog
        If objFolderBrowserDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            "Display the selected folder
            System.Console.WriteLine(objFolderBrowserDialog.SelectedPath)
        End If
        "Clean up
        objFolderBrowserDialog.Dispose()
        objFolderBrowserDialog = Nothing
    End Sub
End Class


FolderBrowserDialog.SelectedPath

  
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Public Class MainClass
    
    Shared Sub Main()
        Dim dlgFolder As System.Windows.Forms.FolderBrowserDialog
        dlgFolder = New System.Windows.Forms.FolderBrowserDialog

        dlgFolder.SelectedPath = "C:\"
        If dlgFolder.ShowDialog() = DialogResult.OK Then
            Console.WriteLine( dlgFolder.SelectedPath)
        End If
    End Sub
End Class


FolderBrowserDialog.ShowDialog()

  
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Public Class MainClass
    
    Shared Sub Main()
        Dim dlgFolder As System.Windows.Forms.FolderBrowserDialog
        dlgFolder = New System.Windows.Forms.FolderBrowserDialog

        dlgFolder.Description = "Select the folder that contains the XML files."
        If dlgFolder.ShowDialog() = DialogResult.OK Then
            Console.WriteLine( dlgFolder.SelectedPath)
        End If
    End Sub
End Class


FolderBrowserDialog.ShowNewFolderButton

  
Imports System
Imports System.Collections
Imports System.ruponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.IO
Imports System.Drawing.Printing

Public Class MainClass
    Shared Sub Main()
        "Declare a FolderBrowserDialog object
        Dim objFolderBrowserDialog As New FolderBrowserDialog
        "Set the FolderBrowserDialog control properties
        objFolderBrowserDialog.Description = "Select your favorite folder:"
        objFolderBrowserDialog.RootFolder = Environment.SpecialFolder.Personal
        objFolderBrowserDialog.ShowNewFolderButton = True
        "Show the Browse For Folder dialog
        If objFolderBrowserDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            "Display the selected folder
            System.Console.WriteLine(objFolderBrowserDialog.SelectedPath)
        End If
        "Clean up
        objFolderBrowserDialog.Dispose()
        objFolderBrowserDialog = Nothing
    End Sub
End Class