vb.netenvironment-variablesprogram-files

Get path from Environment.GetEnvironmentVariable Method in vb


I am using visual basic and Environment.GetEnvironmentVariable Method and I want to get the path of Environment.GetEnvironmentVariable(Program Files).How is that possible? *I want to use that method instead of writing (C:/ProgramFiles), because some users have Windows installed in D Drive.. I also want to get the path in textbox1.text .Thank's for help!


Solution

  • Environment.GetFolderPath( Environment.SpecialFolder.ProgramFiles)
    

    SpecialFolder enumeration on MSDN