I need to get the values of some fields shown on a report in a VB.NET / Winforms app, and I've used the code from here;
However, I'm experiencing a crash at the first step of getting the InstanceReportSource with a cast exception as per the title.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim instanceReportSource As InstanceReportSource =
DirectCast(Me.TKReportViewer.ReportSource, InstanceReportSource) <========= Invalid Cast here
Dim report As Telerik.Reporting.Report =
DirectCast(instanceReportSource.ReportDocument, Telerik.Reporting.Report)
Dim txt As Telerik.Reporting.TextBox =
TryCast(report.Items.Find("quoteReferenceNumber", True)(0), Telerik.Reporting.TextBox)
End Sub
I can't find any other questions / answers on this - anyone have an idea what might be wrong?