Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Mar 30, 2020 12:03 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to use Exception err As ????? for Boolean values
PostPosted: Sat Jun 09, 2012 1:28 pm 
Offline
User avatar

Joined: Thu Dec 29, 2011 6:46 pm
Posts: 191
Location: Edmonton, AB, Canada
How do I use EXPECTION to capture a error


Exception err As (?????)

If Not IsNumeric(var) Then

MsgBox err.Message+".Error Code: "+ Str(err.errorNumber)

else

Increment = var + 1

end if

_________________
Regards,
TomazVDaSilva


Clean Code: Robert C. Martin
It is not the language that makes programs appear simple.
It is the programmer that make the language appear simple!


Top
 Profile  
Reply with quote  
 Post subject: Re: How to use Exception err As ????? for Boolean values
PostPosted: Sat Jun 09, 2012 2:14 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
MyBadCode()

Exception err1 As IllegalCastException
// Handle this

Exception err2 As NilObjectException
// Handle the nil object

Exception err3 As TypeMismatchException
// Handle the type mismatch

Exception err4 As RuntimeException
// It wasn't any of those, so deal with it here


RB will run through the exceptions until it matches the kind that occurred. Is that what you meant?

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to use Exception err As ????? for Boolean values
PostPosted: Sat Jun 09, 2012 2:41 pm 
Offline
User avatar

Joined: Thu Dec 29, 2011 6:46 pm
Posts: 191
Location: Edmonton, AB, Canada
ktekinay,

Thank you it is more than I asked for...
Let me try I will give you a feedback

TKS

_________________
Regards,
TomazVDaSilva


Clean Code: Robert C. Martin
It is not the language that makes programs appear simple.
It is the programmer that make the language appear simple!


Top
 Profile  
Reply with quote  
 Post subject: Re: How to use Exception err As ????? for Boolean values
PostPosted: Sat Jun 09, 2012 3:01 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
One more thing: You can also use IsA.
MyBadCode()

Exception err As RuntimeException
if err IsA NilObjectException then
// Handle it
elseif err IsA TypeMismatchException then
// Handle that
elseif err IsA ...
// Continue the list you want to handle in a specific way
else
// Handle any remaining types
end if

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group