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

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

liminma8458
Collaborator Collaborator
853 Views
2 Replies
Message 1 of 3

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

liminma8458
Collaborator
Collaborator

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 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 Likes
Accepted solutions (1)
854 Views
2 Replies
Replies (2)
Message 2 of 3

MegaJerk
Collaborator
Collaborator
Accepted solution
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

xiaodong_liang
Autodesk Support
Autodesk Support

Hi liminma8458,

 

0 Likes