Re: Productivity




"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


.



Relevant Pages

  • Re: Structured exception information
    ... Write_Output for different hardware will need need a corresponding ... version of the exception type; ... the messages are indeed string literals, ... The Ada compiler checks coverage. ...
    (comp.lang.ada)
  • Compiler executable file c:..v1.1.4322csc.exe cannot be found.
    ... But as the compiler _IS_ there, I don't see why it does this ... Exception Details: System.InvalidOperationException: Compiler ... options, String compilerDirectory, String compilerExe, String ... CompilerParameters parameters, Evidence evidence) +478 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Custom Exception Handler Class
    ... compiler that my custom class will handle the exception appropriately. ... > if(key is string) ...
    (microsoft.public.dotnet.framework)
  • Re: C++ exceptions are broken in FreeBSD with gcc-compiled code?
    ... system g++ compiler. ... % c++ -o exc exc.c ... Caught an exception "String" ...
    (freebsd-hackers)
  • Re: DBExpress in DeXter
    ... In that case do all my users need to install .net runtime? ... or only the SQL Server machine that needs the runtime? ... strUser, strPassword:string; ServerType: TMyAppServer): string; ... var strConnection:string; ...
    (borland.public.delphi.non-technical)