Tuesday, August 4, 2015

Driver of current Windows VB.net

 

Hey welcome back guys.
Today I will show how you can get the driver letter of current Windows. It´s very simple.

1- Open your Visual Studio program
2- Select Visual Basic language. Rename it and create the project
3- Double-Click in the Form or press F7 to open the code form. If you use F7 you have to generate the Load Event of the form
(In this case I´m gonna use a MessageBox but you can use also a Label, TextBox …)
4- In the begin of the code form add this line of code:

Imports.System.IO

5- Finally in the Load Event add this line:

Dim driver = Path.GetPathRoot(Environment.SystemDirectory)
MsgBox(driver , vbOk + vbInformation, “What is the letter of my Windows ?”)


 
And if I use a TextBox or Label ? It´s simple.
Dim driver = Path.GetPathRoot(Environment.SystemDirectory)
Label1.Text = driver
TextBox1.Text = driver




No comments:

Post a Comment