One way to approach the problem.
On the line BEFORE you line (line 19 in your image), put the following code. At the point where the exception is occurring then you will get a MessageBox showing the current value as read by your ObjectReader.
Try obj = objReader.ReadLine() Dim dec As Decimal = Convert.ToDecimal(obj) Catch ex As FormatException MessageBox.Show(obj.ToString) Stop End Try
I suspect you will find it to be something that doesn't form a valid Decimal - such as a String of alpha character(s).
You can prevent a 'crash' by using a function (such as the following) which will return a value of ZERO instead of an exception. This doesn't solve the issue where your data is returning an unexpected value though.
Function GetDecimal(s As String) As Decimal Dim v As Decimal = 0.0D If Decimal.TryParse(s, v) Then Return v Return 0.0D End Function
Instead of above code, you would try:
Dim dec As Decimal = 0.0D Try obj = objReader.ReadLine() dec = GetDecimal(obj.ToString) Catch ex As FormatException MessageBox.Show(obj.ToString) Stop End Try MessageBox.Show(obj.ToString & " " & dec.ToString) Stop