Results 1 to 2 of 2

Thread: [RESOLVED] Loop though an object getting key and value

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    294

    Resolved [RESOLVED] Loop though an object getting key and value

    I am looking to replace something like
    VB Code:
    1. Private Sub Form_Load()
    2.     Dim Row As Object
    3.     For Each Row In GetObject("winmgmts:\\127.0.0.1\root\CIMV2"). _
    4.       ExecQuery("SELECT ScreenHeight,ScreenWidth FROM Win32_DesktopMonitor", "WQL", &H10 + &H20)
    5.         Debug.Print "ScreenHeigh", Row.ScreenHeight
    6.         Debug.Print "ScreenWidth", Row.ScreenWidth
    7.     Next
    8. End Sub
    with
    VB Code:
    1. Private Sub Form_Load()
    2.     Dim Row As Object
    3.     Dim Col As Object
    4.     For Each Row In GetObject("winmgmts:\\127.0.0.1\root\CIMV2"). _
    5.       ExecQuery("SELECT ScreenHeight,ScreenWidth FROM Win32_DesktopMonitor", "WQL", &H10 + &H20)
    6.         For Each Col In Row
    7.             Debug.Print Key(Col), Value(Col)
    8.         Next
    9.     Next
    10. End Sub

    Second example don't wanna work.

    Edit: fixed a typ0.
    Last edited by frozen; Apr 8th, 2006 at 12:24 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width