Skip to Content

Dynamically set report field value

In my old classic VB project, I was able to set a report field value using the following simple line of code.

someReport.SomeField.SetText u201Cabcu201D

This was nice and simple, now with crystal reports .Net I do the following:

((TextObject)someReport.SectionX.ReportObjects["SomeField"]).Text = u201Cabcu201D;

Itu2019s simple enough but seems too elaborated compared to the good old VB6.

Not that is a big deal but is there a simpler way (Classic VB6 style) to set a field on a report without me having to create my own utility method to u201Csimplifyu201D things?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2011 at 09:10 PM

    Hello,

    What you've described is the difference between two different SDKs. Using the CR.NET SDK requires different code than that used for the RDC.

    Sincerely,

    Dan Kelleher

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 18, 2011 at 09:12 PM

    Perhaps using a formula?

     
    
    
    Imports CrystalDecisions.CrystalReports.Engine 
    Imports CrystalDecisions.Shared 
    Public Class Form1 
    Inherits System.Windows.Forms.Form 
    Dim Report As New CrystalReport1() 
    Dim FormulaFields As FormulaFieldDefinitions 
    Dim FormulaField As FormulaFieldDefinition 
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
    FormulaFields = Report.DataDefinition.FormulaFields 
    FormulaField = FormulaFields.Item(0) 
    FormulaField.Text = "[formula text]" 
    CrystalReportViewer1.ReportSource = Report 
    End Sub 
    
    
    

    Other than that, InProc RAS, but if the solution you have is complicated, you ain't seen nothing yet 😊

    - Ludek

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.