Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

system.IO.Directory.exists

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shughes@ddpa.org - 16 Oct 2007 14:25 GMT
i am not really a programmer, so i have a question on the
system.io.directory.exists

what i am trying to do is have a button, once this button is clicked
it checks to see if the Directory exists, if it does it posts a
message saying software already installed. if not i want to launch the
software from a website to install the appplication. here is what i
have so far.

private void button1_Click(object sender, EventArgs e)
       {
           if (System.IO.Directory.Exists(@"c:\Path"))
               System.Console.WriteLine("Already Installed");
           else
               System.Diagnostics.Process.Start("Program", "web
Location");

       }
Ignacio Machin ( .NET/ C# MVP ) - 16 Oct 2007 14:35 GMT
Hi,

You first have to download the software install file and only then you use
Process.Start

Signature

Ignacio Machin
www.laceupsolutions.com
Mobile & warehouse Solutions.

>i am not really a programmer, so i have a question on the
> system.io.directory.exists
[quoted text clipped - 14 lines]
>
>        }
Jon Skeet [C# MVP] - 16 Oct 2007 14:40 GMT
On Oct 16, 2:25 pm, shug...@ddpa.org wrote:
> i am not really a programmer, so i have a question on the
> system.io.directory.exists

Well, you've given some code - but what's your actual question? And is
this within a web form or WinForms?

Jon
shughes@ddpa.org - 16 Oct 2007 17:34 GMT
> On Oct 16, 2:25 pm, shug...@ddpa.org wrote:
>
[quoted text clipped - 5 lines]
>
> Jon

This is in a windows form,

what i am trying to get at is, if the directory already exists within
their PC the button does not appear, is the Directory is not there, i
am going to user the Process.start to send then to the download page,
to install the program.
Jon Skeet [C# MVP] - 16 Oct 2007 18:40 GMT
> > On Oct 16, 2:25 pm, shug...@ddpa.org wrote:
> >
[quoted text clipped - 10 lines]
> am going to user the Process.start to send then to the download page,
> to install the program.

If the button doesn't appear at all, then you can't react to the click
event. It sounds like you need to tell us a bit more of the bigger
picture, and in particular what problems you're having.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

shughes@ddpa.org - 16 Oct 2007 21:04 GMT
>  <shug...@ddpa.org> wrote:
> > > On Oct 16, 2:25 pm, shug...@ddpa.org wrote:
[quoted text clipped - 19 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet  Blog:http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too

>From the Code i posted, nothing happens not even going out to the
website i selected from the process.start event. i do not even get the
message.

this by itself works fine in association to the button------>
System.Diagnostics.Process.Start("Program", "web Location");

the moment i add the code to check the system directory, i get no
error but i get no response from the button either.

so my objective is to check the system root for a specific set of
folders. if those folders exist then the button should not appear. if
the directory is missing, the button should show up and then take me
to the web address i have suppled.

the reason i have placed the message in the dialog box is cause i
wanted to make sure it was working, before i figured how to only
display the button if the directory is not there.
Jon Skeet [C# MVP] - 16 Oct 2007 22:48 GMT
> From the Code i posted, nothing happens not even going out to the
> website i selected from the process.start event. i do not even get the
[quoted text clipped - 5 lines]
> the moment i add the code to check the system directory, i get no
> error but i get no response from the button either.

I suggest you run this in the debugger, and put a breakpoint at the
start of the event handler - then you can see what's going on.

> so my objective is to check the system root for a specific set of
> folders. if those folders exist then the button should not appear. if
[quoted text clipped - 4 lines]
> wanted to make sure it was working, before i figured how to only
> display the button if the directory is not there.

You haven't got a dialog box - you've got output to the console. If you
were expecting a dialog box, that's probably what's wrong.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

shughes@ddpa.org - 17 Oct 2007 13:27 GMT
>  <shug...@ddpa.org> wrote:
> > From the Code i posted, nothing happens not even going out to the
[quoted text clipped - 25 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet  Blog:http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too

that is what i though the:
System.Console.WriteLine("Already Installed");
does. meaning i though a pop would be induced from that command. what
would be the command to cause a pop state the response i want.
Jon Skeet [C# MVP] - 17 Oct 2007 16:10 GMT
On Oct 17, 1:27 pm, shug...@ddpa.org wrote:

<snip>

> that is what i though the:
> System.Console.WriteLine("Already Installed");
> does.

No, that writes to the system console - which may not be attached to
that anything for that process.

> meaning i though a pop would be induced from that command. what
> would be the command to cause a pop state the response i want.

MessageBox.Show.

Jon
Nicholas Paldino [.NET/C# MVP] - 16 Oct 2007 15:35 GMT
Well, if you want to perform a download, you are going to have to use
the WebClient, or the HttpWebRequest/HttpWebResponse classes in the
System.Net namespace.

   However, I would suggest that you look into ClickOnce, as it does pretty
much everything you are looking to have it do already.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>i am not really a programmer, so i have a question on the
> system.io.directory.exists
[quoted text clipped - 14 lines]
>
>        }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.