Public Enum emul Auto = 0 V7 = 7 V8 = 8 V9 = 9 V10 = 10 V11 = 11 End Enum Public Sub initBrowserVersion(wb As WebBrowser, emulation As emul) Dim ValueSet As New Dictionary(Of String, Integer) ValueSet.Add("V7", 7000) ValueSet.Add("V8", 8000) ValueSet.Add("V9", 9000) ValueSet.Add("V10", 10001) ValueSet.Add("V11", 11001) Dim IEValue As String = "" If emulation = emul.Auto Then IEValue = String.Format("V{0}", wb.Version.Major) Else IEValue = emulation.ToString() End If Dim NKey As RegistryKey NKey = Nothing Dim valkey As RegistryKey valkey = Nothing Dim targetApplication = Process.GetCurrentProcess() NKey = Registry.CurrentUser valkey = NKey.OpenSubKey("SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION\", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl) If (valkey Is Nothing) Then NKey.CreateSubKey("SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION\", RegistryKeyPermissionCheck.ReadWriteSubTree) valkey = NKey.OpenSubKey("SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION\", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl) End If If (Not valkey Is Nothing) Then Try valkey.SetValue(String.Format("{0}.exe", targetApplication.ProcessName), ValueSet(IEValue), RegistryValueKind.DWord) Catch ex As Exception Throw End Try End If End Sub