I am trying to add the Crystal Reports 11 ActiveX Viewer to my VB.Net application. My VB.Net app is simply a reports menu so people can choose and run and preview a Crystal Report prior to printing it.
But I've got zillions of errors and don't know how to fix some of them. I've never used VB.Net, but I have 3 forms working, now I am just trying to add this Crystal Report part.
Here is my code with my questions before and after each section of code:
1. If I imported these same things under Project Properties do I still need them at the top of my code page before anything else?
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
2. I am not sure where to put these two DIM statements.
3. I also don't know why I get an error that says CrystalReport1 is not defined.
4. And in the Set command below the entire string between the parentheses "( )" is full of errors and I have not been able to fix them.
5. Me.ScaleHeight and Me.ScaleWidth is not a member of my WindowsAppForm? Why?
One fix might fix all of these errors, but I haven't figured it out. Thanks for your help.
Dim Report As New CrystalReport1
Dim crViewer As Object
Private Sub Form_Load()
Set crViewer = Me.Controls.Add("CrystalReports11.ActiveXReportViewer.1", "crViewer")
With crViewer
.Visible = True
.ReportSource = Report
.ViewReport
.Zoom 100
End With
End Sub
Private Sub Form_Resize()
With crViewer
.Top = 0
.Left = 0
.Height = Me.ScaleHeight
.Width = Me.ScaleWidth
End With
End Sub
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site:
www.stephenkramer.comWould you believe Far Side Lite?
More than 270 original cartoons.