Re: Productivity
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Wed, 27 Dec 2006 14:22:22 -0500
"Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx> wrote in message
news:4vfl66F1as7a4U1@xxxxxxxxxxxxxxxxxxxxx
Pete Dashwood<dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> 12/27/06 3:40 AM >>>
What happens if no file is selected?
Dunno, but I believe that's a function of the .NET runtime. I will try it
and see what happens.
Perhaps the string will be set to null or the empty string or something
similar. It's probably explicitly stated in the OpenFileDialog
documentation.
Suppose the selected file is deleted moments after you select it?
I am no where near proficient in WinForms or any kind of event driven
program. The fact that I could even come up with the code above is only
thanks to the ease of use of VS2005!
Nothing will happen yet... the only thing your code does is to get a
string representing the path to the selected file (before it was deleted).
Now, if all you're going to do is display that string to user, no problem
should arise (except maybe for a confused user who can no longer find
specified file). But if you try to open that file, then a
FileNotFoundException will probably get thrown.
In Java, the compiler would complain unless you explicitly put code to
deal with the possibility of that exception arising. In .NET, the compiler
wouldn't say anything, and if the exception DOES come up during runtime, and
you haven't added code to handle it, the program will just terminate,
possibly emitting some debugging info (e.g. a stack trace) to the console.
- Oliver
.
- References:
- Productivity
- From: Pete Dashwood
- Re: Productivity
- From: HeyBub
- Re: Productivity
- From: Pete Dashwood
- Re: Productivity
- From: Robert Jones
- Re: Productivity
- From: Pete Dashwood
- Re: Productivity
- From: Frank Swarbrick
- Re: Productivity
- From: Pete Dashwood
- Re: Productivity
- From: Frank Swarbrick
- Productivity
- Prev by Date: Re: COBOL interview tests
- Next by Date: Re: running rm cobol in a cron job
- Previous by thread: Re: Productivity
- Next by thread: Re: Productivity
- Index(es):
Relevant Pages
|