| | |
Plz HELP Convert DataGrid to TextBox
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 1
Reputation:
Solved Threads: 0
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.
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.
VB.NET Syntax (Toggle Plain Text)
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
You could start off by using the System.IO namespace of the .NET Framework. What is the purpose of storing all that info in textbox? You could store some sort of a unique identifier as the value of the textbox and then when a user selects something from the textbox, showw the details of the drive[object] that they selected.
![]() |
Similar Threads
- Data grid urgent help....very urgent (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: how to prepare a document
- Next Thread: how i make table in visual studio by using vb.net
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





