Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Vb.net Treeview Example

Featured Replies

This is a simple demo of Vb.net Treeview control. What this does is uses the the Treeview and list all active drives on the computer. This then adds a node for file system, drive type,drive size, drive free, drive used. It also adds two tooltips that list the percent free and percent

used.

ActiveDiskInformation.png

Public Class Form1
Const GB = 1073741824
Const MB = 1048576
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ND As TreeNode
ND = TreeView1.Nodes.Add(String.Format(My.Computer.Name))
DiskInfo()
End Sub
Private Sub DiskInfo()
For Each Drv In My.Computer.FileSystem.Drives
If Drv.IsReady Then
' Disk Size
Dim St = "", S1 = ""
If Drv.TotalSize < GB Then
St = " MB"
S1 = FormatNumber(Drv.TotalSize / MB, 2)
Else
St = " GB"
S1 = FormatNumber(Drv.TotalSize / GB, 2)
End If
If Len(S1) = 4 Then S1 = "00" & S1
If Len(S1) = 5 Then S1 = "0" & S1
' Disk Free
Dim F1 = Drv.TotalFreeSpace, F2 = "", F3 = "", Ft = ""
If F1 < GB Then
Ft = " MB"
F2 = FormatNumber(F1 / MB, 2)
Else
Ft = " GB"
F2 = FormatNumber(F1 / GB, 2)
End If
If Len(F2) = 4 Then F2 = "00" & F2
If Len(F2) = 5 Then F2 = "0" & F2
F3 = "Percent Free : " & FormatPercent(F1 / Drv.TotalSize, 2)
' Disk Used
Dim U1 = Drv.TotalSize - Drv.TotalFreeSpace, U2 = "", U3 = "", Ut = ""
If U1 < GB Then
Ut = " MB"
U2 = FormatNumber(U1 / MB, 2)
Else
Ut = " GB"
U2 = FormatNumber(U1 / GB, 2)
End If
If Len(U2) = 4 Then U2 = "00" & U2
If Len(U2) = 5 Then U2 = "0" & U2
U3 = "Percent Used : " & FormatPercent(U1 / Drv.TotalSize, 2)
Dim node As TreeNode
node = TreeView1.Nodes.Add(String.Format(Drv.Name & Drv.VolumeLabel))
node.Nodes.Add(String.Format("File " & Drv.DriveFormat))
Dim Dtype = ""
Select Case Drv.DriveType
Case IO.DriveType.Unknown : Dtype = "Unknown Drive Type"
Case IO.DriveType.NoRootDirectory : Dtype = "No Root Directory Drive"
Case IO.DriveType.Removable : Dtype = "Removable Drive"
Case IO.DriveType.Fixed : Dtype = "Hard Drive"
Case IO.DriveType.Network : Dtype = "Network Drive"
Case IO.DriveType.CDRom : Dtype = "Optical Drive"
Case IO.DriveType.Ram : Dtype = "Ram Drive"
End Select
Dim N As TreeNode
N = node.Nodes.Add(String.Format("Type " & Dtype))
N.ForeColor = Color.FromArgb(1, 32, 96, 147)
Dim N1 As TreeNode
N1 = node.Nodes.Add(String.Format("Size " & S1 & St))
N1.ForeColor = Color.FromArgb(1, 32, 179, 131)
Dim N2 As TreeNode
N2 = node.Nodes.Add(String.Format("Free " & F2 & Ft))
N2.ForeColor = Color.FromArgb(1, 32, 131, 179)
N2.ToolTipText = F3
Dim N3 As TreeNode
N3 = node.Nodes.Add(String.Format("Used " & U2 & Ut))
N3.ForeColor = Color.FromArgb(1, 227, 121, 68)
N3.ToolTipText = U3
End If
Next
End Sub
End Class

Source Code

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.