I'm writing an Excel add-in in VB.NET using the Interop Library. I write code with Option Strict On which dis-allows late-binding but I can normally get around this by explicitly casting the type. However, there is what appears to be an undeclared property/method on a chart (DisplayValueNotAvailableAsBlank) which works fine if I allow late-binding, but I'm unable to cast it properly because it isn't recognised by the intellisense.
I can wrap it up in a separate sub as shown in the code, so I can just have a single module with late-binding, but it seems a bit unsatisfactory to me. This must also be a problem in C#.
Sub HideNAValues(myChart As Chart, valIn As Boolean)
myChart.DisplayValueNotAvailableAsBlank = valIn
End Sub
public void HideNAValues(Chart myChart, bool valIn)
{
myChart.DisplayValueNotAvailableAsBlank = valIn;
}
In VB I can set and use this property and it works correctly provided that I allow late-binding. If I disallow late-binding or use C# then I can't. How can I overcome this?