Thread: Another Exception problem

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    105

    Another Exception problem

    Greets! I got stuck again with handling Exception.
    This time however is a bit different.
    My code is the following:
    Code:
    try  {StrToInt(txtBox1hossz->Text);}
        catch(...) {ShowMessage("You should have given an integer!"); goto subroutineend;}
    But it does not what is should.

    When I write a text into txtBox1hossz (not an integer), it gives me the error window of the EConvertError, not the message I wanted it to display!
    After I make the program run further, it displays my error message.
    But I only want it to display my message, when I write an improper value to the textbox, and jump to the subroutineend label.

    How can I do this?

    Thanks for help again!

    Han

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    It sounds like the exception is being caught by another handler higher up in your code. Remove the handler if you don't want it to be caught there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exception handling
    By coletek in forum C++ Programming
    Replies: 2
    Last Post: 01-12-2009, 05:28 PM
  2. stack trace in exception
    By George2 in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2008, 03:00 AM
  3. Problem with the exception class in MINGW
    By indigo0086 in forum C++ Programming
    Replies: 6
    Last Post: 01-20-2007, 01:12 PM
  4. problem with exception behavior
    By agarwaga in forum C++ Programming
    Replies: 3
    Last Post: 02-27-2006, 05:32 PM
  5. Developing Custom Exception Handler :: C++
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 02-20-2002, 04:21 PM