[Solved] Try-Catch-Finally c# in Console [closed]

Other than what people already said about the try…catch…finally block, I believe what you’re looking for is try { file = new FileStream(“example.txt”, FileMode.Open); file.open(); } catch (Exception ex) { MessageBox.Show(ex.Message); } But you need to add reference to System.Windows.Forms in your project and add the using statement to your class using System.Windows.Forms; Or, if … Read more