I have a form that displays some basic information from a SQL table. I want to print this information to a Crystal Report. The function works great with Option strict off. However, when I turn option strict on I get a "Option Strict On disallows late binding" error.
Here is the code block in question.
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
Cursor = Cursors.WaitCursor
Try
Dim frm As New frmReportView
frm.subject = "CPE Number - " & Me.tbCPE.Text
frm.MdiParent = Me.MdiParent
Dim rpt As Object = New CustPropertyEval
rpt.SetParameterValue("cpe_no", Me.tbCPE.Text)
SetDataSourceShowReport(frm, rpt)
Catch ex As Exception
Cursor = Cursors.Arrow
MsgBox(ex.Message)
End Try
Cursor = Cursors.Arrow
End Sub
The late binding error is on the rpt.SetParameterValue("cpe_no", Me.tbCPE.Text) line. If I comment this out and execute the application The code works fine but it forces the use to enter the cpe_no parameter. I'd prefer to not be stuck with this. Anyone have any idea why I can't pass that parameter with option strict on? Also, frm is a Windows form that displays a crystal report and CustPropertyEval is the crystal report called which accepts one parameter - cpe_no. TIA