I am using a If condition in a Foreachloop to assign a value. but i am getting Object reference not set to an instance of an object error.
Below is the If condition
Not(String.IsNullOrEmpty(str_JDELineDesc.Trim)) And Not(String.IsNullOrEmpty(str_JDEAmountType.Trim)) And Not(String.Equals( str_JDEAmountType,“No Entry”)) AND NOT(String.IsNullOrEmpty(item.ToString.Trim)) AND NOT(String.IsNullOrEmpty(compareValue.Trim)) AND compareValue.Trim.Equals(str_JDELineDesc.Trim)
An error appears to occur by proceeding with the “trim” method without the initial value. It seems necessary to remove the trim or declare the initial value.