Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: VB6 To .Net Report Conversion Post Reply Post New Topic
Author Message
skyinsdevel
Newbie
Newbie


Joined: 01 Nov 2007
Online Status: Offline
Posts: 2
Quote skyinsdevel Replybullet Topic: VB6 To .Net Report Conversion
    Posted: 01 Nov 2007 at 1:34pm

Thank you for any help provided in advance.

Specs:
Database: Access
Crystal Reports: Version 9 Developer Licence with VS.net I believe it is Upgrade
IDE: Visual Studio 2005
 
Ok, I got this project that is done in VB6 there are about 6 reports or more.  That programmer used code to modify his reports at RunTime. He has used code like this:

STARTCODE: (Don't know the tag)

Report1.SelectionFormula = "{@ActivityDate} >= " & CryDateFrom & " AND " & "{@ActivityDate} <= " & CryDateTo
If optSortbyDate.Value = True Then
    Report1.GroupCondition(0) = "GROUP1;{@ActivityDate};DAILY;A"
    Report1.SortFields(0) = "+{@ActivityDate}"
    Report1.SortFields(1) = "+{ActivityLog.Id}"
ElseIf optSortbyUser.Value = True Then
    Report1.GroupCondition(0) = "GROUP1;{ActivityLog.UserId};ANYCHANGE;A"
    Report1.SortFields(0) = "+{ActivityLog.UserId}"
    Report1.SortFields(1) = "+{ActivityLog.Id}"
ElseIf optSortbyNetw.Value = True Then
    Report1.GroupCondition(0) = "GROUP1;{ActivityLog.NetwUser};ANYCHANGE;A"
    Report1.SortFields(0) = "+{ActivityLog.NetwUser}"
    Report1.SortFields(1) = "+{ActivityLog.Id}"
End If
 
ENDCODE:
 
I managed to do three things. One change the database connection:

ReportCls.DataSourceConnections.Item(0).SetConnection("", mdbFileName, False)

Second, change a string in a formula field:
ReportCls.DataDefinition.FormulaFields.Item("Period").Text = """From StartingDate to Ending Date yadayada"""
 
Third, Change the selection formula.
ReportCls.DataDefinition.RecordSelectionFormula = "{@ActivityDate} >= " & "DTSToDate ('2007/1/1')" & " AND " & "{@ActivityDate} <= " & "DTSToDate ('2007/12/12')"
 
The problem lies with the grouping part. There is a set of 3 radiobuttons that specify how is the grouping to be done. I have looked through the ReportClass to no avail on how to change it. 
 
I got about 5-8 more of these, do you also think I should quit? Again thanks for the help.
 
IP IP Logged
ultraspxse
Newbie
Newbie


Joined: 04 Nov 2007
Location: Canada
Online Status: Offline
Posts: 4
Quote ultraspxse Replybullet Posted: 05 Nov 2007 at 8:51am
I don't have a specific solution but have you researched differences between the Crystal runtime engine used to develop the reports originally (assuming version 9) and the runtime for Visual Studio 2005 (10.2.3600.0).
 
I assume your converting the VB6 code into .NET and have imported the reports into the .NET project. Check the version of the CrystalDecisions.CrystalReports.Engine in your Project References.
IP IP Logged
skyinsdevel
Newbie
Newbie


Joined: 01 Nov 2007
Online Status: Offline
Posts: 2
Quote skyinsdevel Replybullet Posted: 12 Nov 2007 at 8:53am

Sorry, have been sent on another errand.  In VS2005 About there is no mention of the Crystal Reports number. I got 9.2.3300 with runtime v.1.0.3705 and another that is 10.2.3600.0 with v.2.0.50727

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.030 seconds.