corelibraries-devexpress-dot-data-dot-utils-dot-environmentpolicy-8c5d239e.md
Prevents DevExpress controls from setting the current directory.
Namespace : DevExpress.Data.Utils
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
public static void SuppressSettingCurrentDirectory()
Public Shared Sub SuppressSettingCurrentDirectory
The following example activates the SuppressSettingCurrentDirectory restrictive policy:
using System;
using System.Windows.Forms;
namespace EnvironmentPolicyDemo {
internal static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DevExpress.Data.Utils.EnvironmentPolicy.SuppressSettingCurrentDirectory();
Application.Run(new Form1());
}
}
}
Imports System
Imports System.Windows.Forms
Namespace EnvironmentPolicyDemo
Friend Module Program
''' <summary>
''' The main entry point for the application.
''' </summary>
<STAThread>
Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
DevExpress.Data.Utils.EnvironmentPolicy.SuppressSettingCurrentDirectory()
Application.Run(New Form1())
End Sub
End Module
End Namespace
The EnvironmentPolicy fires the SettingCurrentDirectory event when the DevExpress control attempts to set the path of the current working directory. Handle the SettingCurrentDirectory event to spot, analyze, and/or cancel the operation based on a specific condition.
Tip
Read the following topic for additional information: Environment Policy.
See Also