Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Console IO w/FileSystem Problems

Status
Not open for further replies.

Abraxus

Programmer
Aug 8, 2006
109
US
I'm sorry to result to a terribly simple question for you, but I am in need of some help. I'm using Visual Basic 2005 Express Edition and trying to create the simplest program possible. Right now all I need to be able to do is read an input (no problem) and then check if a directory exists (just won't work!) Here's what I'm working with:
Code:
Imports System.IO
Module Module1
    Sub Main()
        Dim strFilePath As String
        Dim strPath As String
        Dim i As Integer

        Console.WriteLine()
        Console.Write("Enter path > c:\")
        strFilePath = Console.ReadLine
        strPath = "c:\" & strFilePath
        Console.WriteLine()

        If Directory.Exists(strPath) Then Console.WriteLine("OK") Else Console.WriteLine("FAILED")

    End Sub
End Module
This is my most recent attempt, after which I finally decided I need expert assistance. I've been around and around trying different possibilities with absolutely no success. Most of my experience is with VBScript/ASP and older VB, but I haven't had any luck in VBEE with CreateObject("Scripting.FileSystemObject") either.

In general I'll input "TEST" or "TEST\" at the prompt, a directory that definitely exists, but my message comes back FAILED every time. Any help would be greatly appreciated.

Thanks,
Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top