Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to integrate iLogic error message into VB.NET code?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
liminma8458
767 Views, 2 Replies

How to integrate iLogic error message into VB.NET code?

Hi, everyone,

 

Just wondering whether there is a way to  integrate iLogic error message into VB.NET code.
    
   For example, if use following sentence to read the data from spread sheet.
    LengthFloat=GoExcel.CellValue("tank_data.xls", "Gauges",     "llg_arm_lgth")
   
    if there is no such cell of "llg_arm_lgth", the error message appears as in attached file.                                
    
    Right now I want to use "try...catch... end try" in the iLogic code. I can duplicate the first line of the warning message using VB.NET code, but I can not  reach the second line. Does the iLogic expose this error message through some function? or which VB.NET code does this job?
   
    Thanks a lot.
   
    Limin

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit
2 REPLIES 2
Message 2 of 3
MegaJerk
in reply to: liminma8458

Dim myInt As Integer
Dim myDouble As Double 


Try 
	myDouble = 2147483647 ' or you could use Double.MaxValue .
	
	''' Since 2147483647 is the max size that a 32bit integer can hold
	''' if we add one to it, it should force an overflow error that we 
	''' will capture in the Catch. 
	
	myInt = myDouble + 1
	
	Catch ex As Exception
	''' We've declared that 'ex' will exist as our Exception.
	'''
	''' So if we do run into this Catch (because of some exception) we can 
	''' easily translate that exception to a readable String by using
	''' the following method. 
	MessageBox.Show(ex.ToString ,"Error Catch") 
	
	''' Try setting up this exception catching in your own Try Statement
	''' and checking to see if it gives you the information that you're 
	''' looking for. 
End Try 

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 3 of 3

Hi liminma8458,

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report