Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

C # Error: The runtime binding can not be executed for a NULL reference.

25.10.2018 (👁6135)


 

Error message:

The runtime binding can not be performed on a NULL reference.

 

C # Erroneous code

Excel.Range cell = usedRange.Cells[1, iColumn] as Excel.Range;

String sValue = cell.Value2.ToString();

 

In VSTO Addin, Excel:

When going through Excel cells.

 

Solution:

You have to convert with Convert.ToString (value_with_nulls)

String sValue = Convert.ToString(cell.Value2);

 

Complete error message in

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException

  HResult=0x80131500

  Message=Die Laufzeitbindung kann für einen NULL-Verweis nicht ausgeführt werden.

  Source=<Cannot evaluate the exception source>

  StackTrace:

<Cannot evaluate the exception stack trace>