[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Read contents of Crystal Reports text box in Visual Basic

Posted on 2011-03-13
3
Medium Priority
?
435 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 101

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 101

Accepted Solution

by:
mlmcc earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

649 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