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
Solved! Go to Solution.
Solved by MegaJerk. Go to 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
Hi liminma8458,
I think MegaJerk has answered your question. Could you test at your side and mark it as solution if it helps?