-
March 10th, 2010, 11:59 AM
#1
how to trap an error
hi need some help with this i dont know how to trap errors properly
i have a module passing code from my listbox when user double clicks it (it starts a program using shell function)
now if the file is not found i need to trap the error (err.number is 53 "File Not Found")
when the error is raised i need a msgbox to show stating game is not found and then i need the error to be cleared so that the user can select another line in the listbox.
now the code in the module has 52 shell statments depending on which line in the listbox is double clicked.
below is the code that i need to trap errors on.
Code:
Public Sub Load_Game_Paragon()
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 0 Then
Shell App.Path & "\Roms\Paragon\AroundTheWorld\AroundTheWorld.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 1 Then
Shell App.Path & "\Roms\Paragon\Battleship\Battleship.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 2 Then
Shell App.Path & "\Roms\Paragon\BillyTheQuid\billy_the_quid.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 3 Then
Shell App.Path & "\Roms\Paragon\Blackjack\BlackJack.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 4 Then
Shell App.Path & "\Roms\Paragon\Blockbusters\Blockbusters.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 5 Then
Shell App.Path & "\Roms\Paragon\BrainTeaser\BrainTeaser.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 6 Then
Shell App.Path & "\Roms\Paragon\BuckShot\buckshot.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 7 Then
Shell App.Path & "\Roms\Paragon\Bullseye\BullsEye.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 8 Then
Shell App.Path & "\Roms\Paragon\BullseyeTV\BullsEyeTV.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 9 Then
Shell App.Path & "\Roms\Paragon\Capoeria\capoeria.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 10 Then
Shell App.Path & "\Roms\Paragon\CashPhrase\game.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 11 Then
Shell App.Path & "\Roms\Paragon\Chainetters\Chainletters.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 12 Then
Shell App.Path & "\Roms\Paragon\Chockablock\Chockablock\Chockablock.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 13 Then
Shell App.Path & "\Roms\Paragon\CopsNRobbers\CopsNRobbers.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 14 Then
Shell App.Path & "\Roms\Paragon\DungeonDosh\DungeonDosh.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 15 Then
Shell App.Path & "\Roms\Paragon\Finders\Finders\Find&Seek.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 16 Then
Shell App.Path & "\Roms\Paragon\FruitFrenzy\FruitFrenzy.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 17 Then
Shell App.Path & "\Roms\Paragon\GoldenBoot\GoldenBoot.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 18 Then
Shell App.Path & "\Roms\Paragon\GoldenShot\GoldenShot-LF.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 19 Then
Shell App.Path & "\Roms\Paragon\GoldRush\GoldRush.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 20 Then
Shell App.Path & "\Roms\Paragon\GuessWho\GuessWho.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 21 Then
Shell App.Path & "\Roms\Paragon\HangmansHauntedHouse\HauntedHouse-LF-Static.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 22 Then
Shell App.Path & "\Roms\Paragon\HexAppeal\HexAppeal.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 23 Then
Shell App.Path & "\Roms\Paragon\HocusPocus\hocuspocus.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 24 Then
Shell App.Path & "\Roms\Paragon\InternationalGolfPro2\golf2.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 25 Then
Shell App.Path & "\Roms\Paragon\LordOfTheBling\LordOfTheBling.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 26 Then
Shell App.Path & "\Roms\Paragon\Matrix\Matrix.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 27 Then
Shell App.Path & "\Roms\Paragon\Moneycomb\MONEYCOMB.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 28 Then
Shell App.Path & "\Roms\Paragon\Ninelives\NineLives.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 29 Then
Shell App.Path & "\Roms\Paragon\PharaohsTreasure\PharaohsTreasure.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 30 Then
Shell App.Path & "\Roms\Paragon\PhilTaylorWorldChampionshipDarts\Darts.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 31 Then
Shell App.Path & "\Roms\Paragon\PimpMyRide\PimpMyRide.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 32 Then
Shell App.Path & "\Roms\Paragon\PocketMoney\pool.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 33 Then
Shell App.Path & "\Roms\Paragon\ShootForTheStars\ShootForTheStars.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 34 Then
Shell App.Path & "\Roms\Paragon\SkillBallBingo\game.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 35 Then
Shell App.Path & "\Roms\Paragon\SouthPark\South Park.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 36 Then
Shell App.Path & "\Roms\Paragon\SouthPark2\SouthPark.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 37 Then
Shell App.Path & "\Roms\Paragon\SpaceQuest\SpaceQuest.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 38 Then
Shell App.Path & "\Roms\Paragon\Spin2Win\Spin2Win.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 39 Then
Shell App.Path & "\Roms\Paragon\SpotDeluxe\SpotTheDifference3-LF.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 40 Then
Shell App.Path & "\Roms\Paragon\SpotTheBall\SpotTheBall.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 41 Then
Shell App.Path & "\Roms\Paragon\SpotTheDifference2\SpotTheDifference2-LF.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 42 Then
Shell App.Path & "\Roms\Paragon\StrikeBowling\StrikeBowling.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 43 Then
Shell App.Path & "\Roms\Paragon\StrikeItRich\StrikeItRich.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 44 Then
Shell App.Path & "\Roms\Paragon\StrikeZone\StrikeZone.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 45 Then
Shell App.Path & "\Roms\Paragon\Sudoku\Sudoku.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 46 Then
Shell App.Path & "\Roms\Paragon\SumUp\SumUp_1024.exe"
Form1.WindowsMediaPlayer1.URL = ""
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 47 Then
Shell App.Path & "\Roms\Paragon\TheUltimateMovieQuiz\MovieQuiz4L.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 48 Then
Shell App.Path & "\Roms\Paragon\TOOT\TOOT.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 49 Then
Shell App.Path & "\Roms\Paragon\TrivialPursuit\TrivialPursuit.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 50 Then
Shell App.Path & "\Roms\Paragon\TrivialPursuit2\TrivialPursuit-LF.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 51 Then
Shell App.Path & "\Roms\Paragon\WodCube\GWHL_WordCube.exe"
End If
If Form1.lblBtnPress.Caption = "4" And Form1.List1.ListIndex = 52 Then
Shell App.Path & "\Roms\Paragon\WordUp\WordDrop.exe"
End If
End Sub
there will be another 200 lines of code in different subs in the module i would like the error code to be used on.
thanks for any help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|