Convert / Modify Array List to Data Grid columns

Posted on 2004-11-12
Last Modified: 2010-04-23
I am looking to get the hard drives and spaces from my servers and have the below working great to return it via an array - but wanted to do return each  value as a column in a datagrid - is this possible and if so how?
    Private Function SystemList(ByVal strComputer As String) As ArrayList

        Dim al2 As New ArrayList
        Dim co As ConnectionOptions = New ConnectionOptions()
        co.Username = "Nsadm13"
        co.Password = "houston"
        Dim ms As System.Management.ManagementScope = New System.Management.ManagementScope("\\" & strComputer & "\root\cimv2", co)
        Dim oq As System.Management.ObjectQuery = New System.Management.ObjectQuery("Select * from Win32_LogicalDisk where DriveType=3")
        Dim Query1 As ManagementObjectSearcher = New ManagementObjectSearcher(ms, oq)
        Dim queryCollection1 As ManagementObjectCollection = Query1.Get()
        Dim mo As ManagementObject

        For Each mo In queryCollection1
            al2.Add( _
             "<b>Drive</b>: " & mo("Name").ToString() & _
                        "<br><b>Free Space</b>: " & Data.ConvertBytes(CType(mo("FreeSpace").ToString, Long)) & _
                        "<br><b>Size</b>: " & Data.ConvertBytes(CType(mo("Size").ToString, Long)) _
        Return (al2)

    End Function
Question by:tbaseflug
    1 Comment
    LVL 34

    Accepted Solution


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now