WebBrowser MSIE Version Setting

I have been fiddling with the MS WebBrowser control. As pointed out on this forum and other places, the control will default to MSIE 7 mode unless you set up a registry key to change that. I have 2 methods.

  1. Find the MSIE version on the machine - returns a string:
  Dim y as string
  Dim reg As New RegistryItem("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Internet Explorer")
  Dim name As String 
  Dim value As Variant 
  
  For i As Integer = 0 To reg.KeyCount- 1
    name =  reg.Name(i)
    value = reg.Value(i)
    if trim(name) = "Version" then
      y=value
      exit
    end if
  Next
  
  If left(value,4)="9.11" then return "11"
  If left(value,4)="9.10" then return "10"
  If left(value,1)="9" then return "9"
  If left(value,1)="8" then return "8"
  If left(value,1)="7" then return "7"
  
  return "7"
  1. Setting the registry key - takes the above version in as string ver:
  dim reg as new registryItem("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION")
  If ver="11" then
    reg.Value(app.ExecutableFile.Name) = &h2AF8
  elseif ver="10" then
    reg.Value(app.ExecutableFile.Name) = &h2710
  elseif ver="9" then
    reg.Value(app.ExecutableFile.Name) = &h2328
  elseif ver="8" then
    reg.Value(app.ExecutableFile.Name) = &h1F40
  elseif ver="7" then
    reg.Value(app.ExecutableFile.Name) = &h1B58
  else
    reg.Value(app.ExecutableFile.Name) = &h1B58
  end if

Can anyone see any issues with this?

I think there is a working copypasta blob somewhere if you search for it. I don’t recall if it’s this forum or the rb one.