Erel B4X founder Staff member Licensed User Longtime User Nov 17, 2010 #2 Basic4android uses Try... Catch... End Try blocks. For example: Code: Copy Try Dim in As InputStream in = File.OpenInput(File.DirInternal, "SomeMissingFile.txt") '... Catch Log(LastException) End Try If in.IsInitialized Then in.Close When an exception is raised inside the Try... Catch block, the execution of this block stops and it continues in the Catch... End Try block. If no exception is raised then the Catch... End Try will not be executed. You can use the LastException predefined object to get more information about the exception. Upvote 0
Basic4android uses Try... Catch... End Try blocks. For example: Code: Copy Try Dim in As InputStream in = File.OpenInput(File.DirInternal, "SomeMissingFile.txt") '... Catch Log(LastException) End Try If in.IsInitialized Then in.Close When an exception is raised inside the Try... Catch block, the execution of this block stops and it continues in the Catch... End Try block. If no exception is raised then the Catch... End Try will not be executed. You can use the LastException predefined object to get more information about the exception.
L linum Active Member Licensed User Nov 18, 2010 #4 I'm going to wet my pants... I love the "Try" method and I was always wishing it was available on Basic4PocketPc. Will it ever be implemented on B4PPC? Upvote 0
I'm going to wet my pants... I love the "Try" method and I was always wishing it was available on Basic4PocketPc. Will it ever be implemented on B4PPC?
derez Expert Licensed User Longtime User Nov 18, 2010 #5 Don't do that, hold on... What is wrong with errorlabel in b4ppc ? it catches the errors and sends the program to a label - it is about the same ! Upvote 0
Don't do that, hold on... What is wrong with errorlabel in b4ppc ? it catches the errors and sends the program to a label - it is about the same !
M mjcoon Well-Known Member Licensed User Nov 18, 2010 #6 derez said: What is wrong with errorlabel in b4ppc ? it catches the errors and sends the program to a label - it is about the same ! Click to expand... Functionally the same, as is the use of GoTo to produce the same effect as If ... Then ... Else. And have you never forgotten to put a Return statement before the errorlabel, so that the error is triggered every time? What, never? Mike. Upvote 0
derez said: What is wrong with errorlabel in b4ppc ? it catches the errors and sends the program to a label - it is about the same ! Click to expand... Functionally the same, as is the use of GoTo to produce the same effect as If ... Then ... Else. And have you never forgotten to put a Return statement before the errorlabel, so that the error is triggered every time? What, never? Mike.
Erel B4X founder Staff member Licensed User Longtime User Nov 19, 2010 #7 Will it ever be implemented on B4PPC? Click to expand... Don't know for now... Upvote 0