I am new at C# and can`t find how to check if variable is defined or exist.
This is what I want to do:
Best regards.Code:try { //some sql insert query here } catch (Exception er) { MessageBox.Show(er.Message); } finally { //here I want to check that "Exception er" is defined or exist or value is not null if is not defined or not exist or value is null than messagebox show some message } }
Last edited by Jaan; 03-18-2010 at 07:56 AM. Reason: Please use code tags when you are posting your codes!
I don't think you can use both catch and finally.
Anyway, show the message box in the try section if the code works, and show a message box in the catch section if the code doesn't work.
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks