Back to Devexpress

EnvironmentPolicy.SuppressGettingEnvironmentVariables() Method

corelibraries-devexpress-dot-data-dot-utils-dot-environmentpolicy-5f73598b.md

latest2.6 KB
Original Source

EnvironmentPolicy.SuppressGettingEnvironmentVariables() Method

Prevents DevExpress controls from reading environment variables.

Namespace : DevExpress.Data.Utils

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
public static void SuppressGettingEnvironmentVariables()
vb
Public Shared Sub SuppressGettingEnvironmentVariables

Remarks

The following example activates the SuppressGettingEnvironmentVariables restrictive policy:

csharp
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.SuppressGettingEnvironmentVariables();
            Application.Run(new Form1());
        }
    }
}
vb
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.SuppressGettingEnvironmentVariables()
      Application.Run(New Form1())
    End Sub
  End Module
End Namespace

The EnvironmentPolicy fires the GettingVariable event when the DevExpress control attempts to retrieve the value of the environment variable from the current process. Handle the GettingVariable 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

EnvironmentPolicy Class

EnvironmentPolicy Members

DevExpress.Data.Utils Namespace