Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Convert / Modify Array List to Data Grid columns

Posted on 2004-11-12
Medium Priority
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

flavo earned 2000 total points
ID: 12571710

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) 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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

564 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