Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace ConsoleApplication5
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. while (true)
  15. {
  16. Console.WriteLine(">Enter File to open.");//Prompt user for file name
  17.  
  18. try
  19. {
  20. if (!File.Exists(Console.ReadLine())) ;
  21. throw new FileNotFoundException();//Check for errors
  22.  
  23. }
  24. catch (FileNotFoundException)
  25. {
  26. Console.WriteLine("You stuffed up!"); //Display error message
  27. }
  28. }
  29. System.Diagnostics.Process.Start(@Console.ReadLine()); //set valid reply response
  30. Console.ReadLine();
  31. }
  32.  
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement