[dba-VB] Convert C to VB

Jim Lawrence accessd at shaw.ca
Fri Jul 13 02:37:18 CDT 2007


Hi John:

Check the following site out. You can link to it from the DBA web site:
http://www.carlosag.net/Tools/CodeTranslator/Default.aspx

HTH
Jim

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Thursday, July 12, 2007 9:33 PM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] Convert C to VB

I need to convert a chunk of 'C#' code to Vb.  The code apparently allows
you to get an expanded list of default values for the FolderBrowserDialog.

It isn't much and I (believe I) have mostly figured it out.

http://www.xoc.net/works/tips/folderbrowserdialog.asp

So far I have:

imports System;
imports System.Reflection;

Public Class FolderBrowserDialogEx
    '[Flags()]
    Public Enum CsIdl
        Desktop = &H0 ' Desktop
        Internet = &H1 ' Internet Explorer (icon on desktop)
        Programs = &H2 '// Start Menu\Programs
        Controls = &H3 ' My Computer\Control Panel
        Printers = &H4 ' My Computer\Printers
        Personal = &H5 ' My Documents
        Favorites = &H6 ' user name\Favorites
        Startup = &H7 ' Start Menu\Programs\Startup
        Recent = &H8 ' user name\Recent
        SendTo = &H9 ' user name\SendTo
        BitBucket = &HA ' desktop\Recycle Bin
        StartMenu = &HB ' user name\Start Menu
        MyDocuments = &HC ' logical "My Documents" desktop icon
        MyMusic = &HD ' "My Music" folder
        MyVideo = &HE ' "My Videos" folder
        DesktopDirectory = &H10 ' user name\Desktop
        Drives = &H11 ' My Computer
        Network = &H12 ' Network Neighborhood (My Network Places)
        Nethood = &H13 ' user name\nethood
        Fonts = &H14 ' windows\fonts
        Templates =                 &H0015,
        CommonStartMenu = &H16 ' All Users\Start Menu
        CommonPrograms = &H17 ' All Users\Start Menu\Programs
        CommonStartup = &H18 ' All Users\Startup
        CommonDesktopDirectory = &H19 ' All Users\Desktop
        AppData = &H1A ' user name\Application Data
        PrintHood = &H1B ' user name\PrintHood
        LocalAppData = &H1C ' user name\Local Settings\Applicaiton Data (non
roaming)
        AltStartup = &H1D ' non localized startup
        CommonAltStartup = &H1E ' non localized common startup
        CommonFavorites = &H1F
        InternetCache = &H20
        Cookies = &H21
        History = &H22
        CommonAppdata = &H23 ' All Users\Application Data
        Windows = &H24 ' GetWindowsDirectory()
        System = &H25 ' GetSystemDirectory()
        ProgramFiles = &H26 ' C:\Program Files
        MyPictures = &H27 ' C:\Program Files\My Pictures
        Profile = &H28 ' USERPROFILE
        SystemX86 = &H29 ' x86 system directory on RISC
        ProgramFilesX86 = &H2A ' x86 C:\Program Files on RISC
        ProgramFilesCommon = &H2B ' C:\Program Files\Common
        ProgramFilesCommonx86 = &H2C ' x86 Program Files\Common on RISC
        CommonTemplates = &H2D ' All Users\Templates
        CommonDocuments = &H2E ' All Users\Documents
        CommonAdminTools = &H2F ' All Users\Start
Menu\Programs\Administrative Tools
        AdminTools = &H30 ' user name\Start Menu\Programs\Administrative
Tools
        Connections = &H31 ' Network and Dial-up Connections
        CommonMusic = &H35 ' All Users\My Music
        CommonPictures = &H36 ' All Users\My Pictures
        CommonVideo = &H37 ' All Users\My Video
        Resources = &H38 ' Resource Direcotry
        ResourcesLocalized = &H39 ' Localized Resource Direcotry
        CommonOemLinks = &H3A ' Links to All Users OEM specific apps
        CdBurnArea = &H3B ' USERPROFILE\Local Settings\Application
Data\Microsoft\CD Burning
        ComputersNearMe = &H3D ' Computers Near Me (computered from
Workgroup membership)
        FlagCreate = &H8000 ' combine with CSIDL_ value to force folder
creation in SHGetFolderPath()
        FlagDontVerify = &H4000 ' combine with CSIDL_ value to return an
unverified folder path
        FlagNoAlias = &H1000 ' combine with CSIDL_ value to insure non-alias
versions of the pidl
        FlagPerUserInit = &H800 ' combine with CSIDL_ value to indicate
per-user init (eg. upgrade)
        FlagMask = &HFF00 ' mask for all possible flag values

    End Enum

    Private Sub FolderBrowserDialogEx()
    End Sub


    Public Sub SetRootFolder(ByVal fbd As
System.Windows.Forms.FolderBrowserDialog, ByVal csidl As CsIdl)
        Dim t As System.Windows.Forms.FolderBrowserDialog = fbd.GetType
        dim fi as FieldInfo = t.GetField("rootFolder", BindingFlags.Instance
| BindingFlags.NonPublic);
        fi.SetValue(fbd, (System.Environment.SpecialFolder) csidl);
    End Sub
End Class

That last chunk - SetRootFolder - just isn't cooperating.  Any help much
appreciated.

TIA.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list