Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. vb variants in c#

vb variants in c#

Scheduled Pinned Locked Moved C#
csharpdebugginghelpquestion
2 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Can anyone convert the following vb6 code to c#? Dim SW As SHDocVw.ShellWindows Dim IE As SHDocVW.InternetExplorer Set SW = New ShellWindows For Each IE In SW If TypeOf IE.Document Is HTMLDocument Then Debug.Print IE.hWnd End If Next IE The problem lies in the line "For Each IE In SW" since VB supports typeless variables and C# is typed.

    J 1 Reply Last reply
    0
    • A Anonymous

      Can anyone convert the following vb6 code to c#? Dim SW As SHDocVw.ShellWindows Dim IE As SHDocVW.InternetExplorer Set SW = New ShellWindows For Each IE In SW If TypeOf IE.Document Is HTMLDocument Then Debug.Print IE.hWnd End If Next IE The problem lies in the line "For Each IE In SW" since VB supports typeless variables and C# is typed.

      J Offline
      J Offline
      Jonathan Tan
      wrote on last edited by
      #2

      I don't know if every object in SW is of type InternetExplorer or not. I assume it is not. Use COM Interop or something like that to get all the SHDocVW objects into the .NET system. Then this should work (not sure about the class names): ShellWindows SW = new ShellWindows(); InternetExplorer IE; foreach (object o in SW) { IE = o as InternetExplorer; if (IE.Document is HTMLDocument) Debug.WriteLine (IE.hWnd); } Hope this helps.:)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups