Arithmetic Operation on a Value Extracted from PDF

Hi All,

I have obtained a value from a bank statement and I need to find out if it is a debit or credit. Can some please help with this.

Sample Values:

Debit Value
a = 10
Credit Value
b = -30

I used if condition :

b - b = “0”

option strict on disallows implicit conversions from ‘string’ to ‘Double’

Thanks in advance!


When you get the value, it will be in a string format, so you need to simply convert it as you do the arithmetic.

CDbl(a) - CDbl(b) = 0
Convert.ToDouble(a) - Convert.ToDouble(b) = 0


Hi Clayton,

Thanks for the timely reply.

I want perform string operation and find if the variable is a negative number. The variable is initiated by using Get Text from a PDF.

The value I’m extracting from PDF is -30
I store it in a variable A
I have declared another string variable B= “-”

On If Command I’m using the following condition


A is Negative
A is Positve

If I hard code the value of A as a negative number the condition is working. But if I get it as an input by reading the PDF it executes Else part (i.e. A is positive) even if the input is a negative number.

Can you please help me with this.


Hi @ashoks93

Try this: use if activity:

If Convert.ToInt32(A) > 0

Hi @ashoks93

You will want to verify that the value you are looking at is the correct value. Like with a message box or write line before entering the If condition.

I would recommend not using .Contains(“-”) but instead converting it to a number (of Double type which includes decimals)

If Convert.ToDouble(A.Trim) < 0 then
   A is negative
   A is positive

But like I said, you need to verify that A is coming in correctly like for example as “-30”
You might also want to check if the value is a number like this:

If IsNumeric(A.Trim) then
   If Convert.ToDouble(A.Trim) < 0 then
      A is negative
      A is positive

I hope this helps.