Solved

Read contents of Crystal Reports text box in Visual Basic

Posted on 2011-03-13
3
427 Views
Last Modified: 2012-05-11
Hi experts,

How can I read the contents of a Crystal Reports text box in my visual basic application. My application shows invoices in a Crystal Reports. The user can navigate throught the invoices using the arrows of the CrystalReportViewer.
One of the text boxes of the report shows the invoice number. I want to be able to automatically export invoices to PDF files named by the invoice number (i.e. 1.pdf, 2.pdf, etc.)
Exporting to PDF is not a problem, but I need to know how to read the contents of my Crystal Reports text box (TxtInvoiceNumber) in my VB app.
How can I do that?
0
Comment
Question by:NoraWil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 35122958
This works frm VB6 with CR XI.  Not sure the properties are available through the .Net API

CRReportObject.Sections(SectionNumber).ReoportObjects("ObjectName").Text

You will need your own export button onthe report unless you can intercept the click of the export button.

mlmcc
0
 

Author Comment

by:NoraWil
ID: 35123257
Sorry mlmcc, but I'm not getting further this way. Writing to a Crystal Reports  text box works with


CType(CR.ReportDefinition.ReportObjects("TxtBox"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = "My text"

But the opposite doesn't work.

The Crystal Reports ReportDocument has a Rows property. Perhaps it's possible to read the contents of one of the columns that way, but I can't find any documentation on that property.

0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 35123715
A I stated my syntax works from VB6.  The .Net API is different and I don't have a copy of it or a .Net environment to try it in.

Try this

mlmcc
Private Function GetTextObject _ 
         (ByVal reportObjectName As String) As TextObject
         Dim text As TextObject
      
         If TypeOf _
            (Report.ReportDefinition.ReportObjects. _ 
            Item(reportObjectName)) Is TextObject Then
            text = _ 
               Report.ReportDefinition.ReportObjects. _ 
               Item(reportObjectName)
            GetTextObject = text
         Else : GetTextObject = Nothing
         End If
      End Function

Open in new window

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Crystal Report: Load report failed 5 46
VB.net Is there code behind PowerPivot 2 70
Telerik RadEditor Control Save 8 39
VB.net VSTO Excel Ribbon error 4 27
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question