mujaqo 0 Newbie Poster

Hi,
I’m new to VB and I use the below code to collect local disk drive info, is there a way to store the collected information in a single text box instead of having tables and DataGridView.

Public Function getLogicalDriveStructure() As DataTable
        Dim dt As New DataTable
        dt.Columns.Add(New DataColumn("Description"))
        dt.Columns.Add(New DataColumn("DeviceID"))
        dt.Columns.Add(New DataColumn("FileSystem"))
        dt.Columns.Add(New DataColumn("FreeSpace"))
        dt.Columns.Add(New DataColumn("Name"))
        dt.Columns.Add(New DataColumn("Size"))

        Return dt
    End Function



Public Sub addLogicalDrive(ByRef dt As DataTable, ByVal Description As String, ByVal DeviceID As String, ByVal FileSystem As String, ByVal FreeSpace As String, ByVal Name As String, ByVal Size As String)
        Dim dr As DataRow
        dr = dt.NewRow
        dr("Description") = Description
        dr("DeviceID") = DeviceID
        dr("FileSystem") = FileSystem
        dr("FreeSpace") = FreeSpace
        dr("Name") = Name
        dr("Size") = Size
        dt.Rows.Add(dr)
    End Sub


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim searcher As New Management.ManagementObjectSearcher( _
             "root\CIMV2", "SELECT * FROM Win32_LogicalDisk")
            Dim dt As DataTable = getLogicalDriveStructure()
            For Each queryObj As ManagementObject In searcher.Get()
                addLogicalDrive(dt, queryObj("Description"), queryObj("DeviceID"), queryObj("FileSystem"), Convert.ToString(queryObj("FreeSpace")), queryObj("Name"), Convert.ToString(queryObj("Size")))
            Next
            DataGridView1.DataSource = dt
            
        Catch err As ManagementException
            MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
        End Try


    End Sub