Solved

Read contents of Crystal Reports text box in Visual Basic

Posted on 2011-03-13
3
423 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now