Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts

    delphi 6 NMFTP and TRY Exceptions

    hi all,

    I've been using NMFTP to connect to a server... and it works fine, however when I try and wrap a TRY EXCEPTION on the connection code, if it fails to connect then the application bombs out and gives me a nasty windows/network error, it does not execute the code in my exception block.. I wonder if any one can spot what I have done.. I may well have misunderstood the situation...

    Code:
    try
            NMFTP1.Host := 'hidden.com';
            NMFTP1.Port := 21;
            NMFTP1.UserID := 'hidden';
            NMFTP1.Password := 'hidden';
            NMFTP1.Connect;
            ShowMessage('ok');
    except
            ShowMessage('failed');
            end;
    end;
    So it should try connect, if it fails.. but I want it to display my failed message not the standard error dialouge... as im typing this I thinking that it does run my execption code because the code does error, it just can connect... dang... so on that thinking, if that is the case.. does anyone know away to achevie what I'm trying to do here? show a message and hide all over generic errors if it cant connect?

    thanks for your time all
    Sir P

  • #2
    Regular Coder
    Join Date
    Oct 2008
    Posts
    214
    Thanks
    5
    Thanked 22 Times in 22 Posts
    Try something like that instead:

    Code:
    NMFTP1.Host := 'hidden.com';
    NMFTP1.Port := 21;
    NMFTP1.UserID := 'hidden';
    NMFTP1.Password := 'hidden';
    try
        NMFTP1.Connect;
    except
        on E: Exception do 
            ShowMessage('Failed! Error = ' + E.Message);
    end;

  • Users who have thanked AlexV for this post:

    sir pannels (10-24-2008)

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Thanks wolf


  •  

    Posting Permissions

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