Results 1 to 3 of 3

Hybrid View

  1. #1
    Iamazn1's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    407
    Reputation
    12
    Thanks
    50

    [TuT]Error Handling

    Example: when making a texture remover, you might get an error saying that File isnt found
    Code:
    File.Move("C:\Documents and Settings\Owner\Desktop\File.txt", "C:\Documents and Settings\Owner\Desktop\File2.Txt")
    Lets say File.txt doesnt exist, then the program will crash, because it cant move a file that isnt there. To fix it
    Code:
    Try 
    File.Move("C:\Documents and Settings\Owner\Desktop\File.txt", "C:\Documents and Settings\Owner\Desktop\File2.Txt")
    Catch Ex as Exception
    MessageBox.Show("File not found")
    End Try
    When using that code, if File.txt doesnt exist, then it will not crash, but instead pop up a messagebox.

  2. #2
    -XpliCitt-'s Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    Spokane, Washington
    Posts
    3,230
    Reputation
    63
    Thanks
    2,283
    My Mood
    Tired
    That would work, but it's too general.
    Because if the file is in use or has read only attributes, your little error would pop up with a false error. The correct code would be:

    Code:
    Try 
    File.Move("C:\Documents and Settings\Owner\Desktop\File.txt", "C:\Documents and Settings\Owner\Desktop\File2.Txt")
    Catch Ex as Exception
    MessageBox.Show(Ex.Message)
    End Try

  3. #3
    LegendaryAbbo's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    5,243
    Reputation
    23
    Thanks
    546
    My Mood
    Relaxed
    Ex.Message
    Ex.Message
    Ex.Message
    Ex.Message
    Ex.Message

    wait nvr mind

Similar Threads

  1. [tut] how to fix the installing error (corrupt file)
    By woodz in forum Battlefield Bad Company 2 (BFBC2) Hacks
    Replies: 4
    Last Post: 03-13-2010, 01:01 PM
  2. Handle Your errors already...
    By NextGen1 in forum Programming Tutorials
    Replies: 3
    Last Post: 01-14-2010, 08:44 AM
  3. [TUT] Patcher Update Error [SOLVED]
    By m1cr0 in forum Combat Arms Europe Hacks
    Replies: 0
    Last Post: 07-07-2009, 04:51 AM
  4. [TUT]MPGH Public Hack .DLL Error
    By koolazngy94 in forum CrossFire Hacks & Cheats
    Replies: 21
    Last Post: 06-12-2009, 12:24 PM
  5. [TUT]Anyone with a error on CApub
    By king.joker.9 in forum Combat Arms Hacks & Cheats
    Replies: 6
    Last Post: 09-01-2008, 11:51 AM

Tags for this Thread