Jump to content
Xtreme .Net Talk

Recommended Posts

Guest PaulRuebens
Posted

Okay I'm doing a basic program to see how VB NET works. It simple in that I want to just list the drives on my machine. So far here is my code

 


dim sDrives() as String
dim i as integer
sDrives = Directory.GetlogicalDrives()
For i = 0 to Ubound(sDrives)
Console.Writeline(sDrives(i))
Next

 

Problem I'm getting is that I get an error back that says "Directory not declared".......

 

did I do something wrong? Thanks!

Posted

Try this:

       Dim sDrives() As String
       Dim i As Integer
       sDrives = System.IO.Directory.GetLogicalDrives()
       For i = 0 To UBound(sDrives)
           Console.WriteLine(sDrives(i))
       Next

Guest PaulRuebens
Posted

Thanks Spike.......

 

I actually figured out a solution. I love learing new tricks!

 

Anyway At the very TOP of my code I put in Imports System.IO and it worked like I needed it to!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...