Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2007, 02:03 PM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Specified cast is not valid

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.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Specified cast is not valid. ayem Visual Studio 2008 1 September 8th, 2008 09:15 PM
Specified cast is not valid. Jose P C# 5 May 11th, 2007 08:04 AM
Specified cast is not valid. abstar BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 31st, 2005 03:00 PM
"Specified cast is not valid" help BaBaBooey ASP.NET 1.0 and 1.1 Basics 2 November 23rd, 2004 12:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.