Closed Thread
Results 1 to 2 of 2

Thread: Exeption Variable

  1. #1
    junelis is offline Newbie
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Exeption Variable

    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:

    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
                }
             }
    Best regards.
    Last edited by Jaan; 03-18-2010 at 07:56 AM. Reason: Please use code tags when you are posting your codes!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Davide's Avatar
    Davide is offline Programming God
    Join Date
    Dec 2009
    Location
    Manchester, UK
    Posts
    507
    Blog Entries
    8
    Rep Power
    11

    Re: Exeption Variable

    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

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. structure variable
    By jackson6612 in forum C and C++
    Replies: 14
    Last Post: 05-02-2011, 01:22 PM
  2. Replies: 3
    Last Post: 11-26-2010, 08:53 AM
  3. variable not defined
    By Dorgon in forum Python
    Replies: 7
    Last Post: 11-23-2010, 02:37 AM
  4. set variable on the Index
    By bonty89 in forum PHP Development
    Replies: 2
    Last Post: 03-01-2010, 10:10 AM
  5. multiple variable
    By bordino in forum Visual Basic Programming
    Replies: 3
    Last Post: 07-08-2009, 04:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts