InvalidCastException in Samples PrintGrid

Stimulsoft Reports.NET discussion
Post Reply
wrobbeling
Posts: 1
Joined: Fri Sep 07, 2018 12:36 pm

InvalidCastException in Samples PrintGrid

Post by wrobbeling »

Hello,

I need some help with this samples.

I always become an InvalidCastException.

Code: Select all

 private void PrintDataGrid(DataGrid sender)
        {
            DataView dataView = (DataView)sender.DataSource; // that causes the InvalidCastException

            StiReport report = new StiReport();
            report.ScriptLanguage = StiReportLanguageType.CSharp;
What can I do to fix it?

See the screenshot please.
Attachments
stimulsoft_printgrid.JPG
stimulsoft_printgrid.JPG (54.08 KiB) Viewed 809 times
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: InvalidCastException in Samples PrintGrid

Post by Lech Kulikowski »

Hello,

It is type conversion exception, you can not convert DataTable to DataView.
https://stackoverflow.com/questions/306 ... a-dataview

Thank you.
Post Reply