hey guys,
I hang on one issue since last two weeks. I have
VB 2005 Express edition and crystal report XI 2. When i try to open external crystal report file using
VB 2005 but it shows error as "Specified cast is not valid."
This code is under button_click event.
I tried to search on site but couldn't find solutions over this.
My code as follows:
Dim CR As New ReportDocument()
CR.Load(Application.startuppath & "\Reports\Widal.rpt")
Dim pvName As New ParameterValues
Dim pvDoc As New ParameterValues
Dim pvDate As New ParameterValues
Dim p1 As New ParameterDiscreteValue
Dim p2 As New ParameterDiscreteValue
Dim p3 As New ParameterDiscreteValue
Try
p1.Value = cboDoctor.SelectedValue
pvName.Add(p1)
CR.DataDefinition.ParameterFields("PatName").Apply CurrentValues(pvName)
p2.Value = "ABC"
pvDoc.Add(p2)
CR.DataDefinition.ParameterFields("DocName").Apply CurrentValues(pvDoc)
p3.Value = "09/01/2007"
pvDate.Add(p3)
CR.DataDefinition.ParameterFields("TestDate").Appl yCurrentValues(pvDate)
CRViewer1.ReportSource = CR <-------Error Shows here.
Catch ex As Exception
MsgBox(ex.Message.ToString())
End Try
So, what problem could be there?
Any help would be greatly appreciated.