我試圖將vb6系統轉換爲VB.Net。我已經安裝了Crystal Reports 2016 - 最新版本。我已將控件「Crystal ActiveX報表查看器控件14.0」放在窗體上。設置Crystal Report Viewer 2016控件的ReportSource
當我試圖設置
crViewer.ReportSource = CObj("...\adjrec.rpt")
我得到以下信息:
「System.InvalidCastException:指定的轉換無效。」 & vbCrLf & 「在CrystalActiveXReportViewerLib14.ICrystalReportViewer12.set_ReportSource(對象PVAL)」 & vbCrLf & 「在AxCrystalActiveXReportViewerLib14.AxCrystalActiveXReportViewer.set_ReportSource(對象的值)」 & vbCrLf &「在CrystalReportViewer2.frmViewer.frmViewer_Load(對象發件人,EventArgs e)在d: \的Visual Studio 2017 \項目\ CrystalReportViewer2 \ frmViewer.vb:9" 號線 拋出異常:則 '' 在AxInterop.CrystalActiveXReportViewerLib14.dll
如何設置ReportSource?一個有效的例子將會有所幫助。