Sunteți pe pagina 1din 4

12/2/2014 VS 2008 Send textbox text to crystal report-VBForums

User Name Password Log in Help Register

Remember Me?

Forum What's New?

New Posts FAQ Calendar Forum Actions Quick Links Advanced Search

VBForums Visual Basic Visual Basic .NET VS 2008 Send textbox text to crystal report

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to
proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Results 1 to 3 of 3

Thread: Send textbox text to crystal report


Bagikan 0 Share 0 Tw eet 0 Share

Thread Tools Display

Nov 14th, 2013, 09:41 AM #1

KRENAR
Send textbox text to crystal report
Thread Starter
Lively Member I created this crystal report.where i pass data from my datagridview to this report.

Join Date: Oct 2013


Posts: 124

Featured
* Storing Data in the Cloud
Learn step-by-step how to set
cloud and use it within an applic
* Accessing Cloud Data using
Service
by this code:Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Learn to build a web service a
Handles Button5.Click that consumes your data that is
cloud.
* NEW: Windows Mobile Deve
CodeGuru has launched a new
Development Center with article
Windows Phone Apps, Windows
Dim ds As New DataTable more.
* HTML5 Development Cente
With ds Our portal for articles, videos,
.Columns.Add("Artikulli") HTML5, CSS3, and JavaScript
.Columns.Add("Cmimi")
.Columns.Add("Sasia")
.Columns.Add("DDV%") Click Here to Expand Forum to Fu
.Columns.Add("CmimiTotal")

Survey posted by VBForums.


End With
For Each dr As DataGridViewRow In Me.DataGridView1.Rows
ds.Rows.Add(dr.Cells("Column3").Value, dr.Cells("Column5").Value, dr.Cells("Column4").Value,
dr.Cells("Column8").Value, dr.Cells("Column6").Value)
Next

Dim rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument

rptDoc = New CrystalReport1


rptDoc.SetDataSource(ds)
Me.CrystalReportViewer1.ReportSource = rptDoc

End Sub

Now i want data frome some Textboxes in my Fimr3 examle to be sendet to this report.

http://www.vbforums.com/showthread.php?742963-Send-textbox-text-to-crystal-report 1/4
12/2/2014 VS 2008 Send textbox text to crystal report-VBForums
example those textboxes:

To be Added in crystal reports section 1 ( repory header) for example without using database only copy
the text from those textboxes to some textboxes created in this crystalreport.

Anyone help me to solve thish:SHOW ME SOME CODE.

Reply With Quote

Nov 15th, 2013, 12:48 AM #2

IanRyder
Re: Send textbox text to crystal report
Fanatic Member
Hi,

This is for Crystal Reports with VS2010 (version 9 I think?)

You can do this by adding Parameters to your Crystal Report. You can then set those parameters at
Join Date: Jan 2013 runtime in your own code rather that letting Crystal Reports prompt you for those parameters when the
Location: Healing, UK report runs.
Posts: 913
So, create a Parameter on your report and let's call it "myReportCriteria" for this example and place it
wherever you want on your report. Then when you run your report you can use this code to set the
parameters using whatever objects types you want in your own project:-

vb.net Code:
1. Dim selectionCriteria as string = "Whatever You Want"
2.
3. 'Create a New instance of the Crystal Report
4. Dim myReport As New rptInvoiceList
5. 'Set the Reports DataSource and Set any Parameters that you want to p
ass to the Report
6. With myReport
7. .SetDataSource(invoiceDT)
8. .SetParameterValue("myReportCriteria", selectionCriteria)
9. End With
10. 'Show the report

Hope that helps.

Cheers,

Ian

BTW, It's important to set the DataSource before you set any parameters otherwise you will still be
prompted for those Parameters.

[Edit] Just checked and to clarify, it is CR Version 13 with VS2010.

Last edited by IanRyder; Nov 15th, 2013 at 12:52 AM. Reason: Checked Version

Reply With Quote

Nov 15th, 2013, 04:31 PM #3

KRENAR
Re: Send textbox text to crystal report
Thread Starter
Lively Member Thank you buddy.But i have done like this and its workin perfectly.\

Join Date: Oct 2013 Dim rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument


Posts: 124
Dim T As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T1 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T2 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T3 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T4 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T5 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T6 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T7 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T8 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T9 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T10 As CrystalDecisions.CrystalReports.Engine.TextObject

http://www.vbforums.com/showthread.php?742963-Send-textbox-text-to-crystal-report 2/4
12/2/2014 VS 2008 Send textbox text to crystal report-VBForums
Dim T11 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T12 As CrystalDecisions.CrystalReports.Engine.TextObject
Dim T13 As CrystalDecisions.CrystalReports.Engine.TextObject

rptDoc = New CrystalReport1

T = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text3")
T.Text = TextBox11.Text

T1 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text8")
T1.Text = "Adresa : " & TextBox12.Text

T2 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text9")
T2.Text = "Tel/Fax : " & TextBox13.Text

T3 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text10")
T3.Text = "Danocen Broj : " & TextBox14.Text

T4 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text11")
T4.Text = "Z-Smetka : " & TextBox15.Text

T5 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text13")
T5.Text = "DDV 5% : " & TextBox5.Text & " Den"

T6 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text14")
T6.Text = "DDV 18% : " & TextBox6.Text & " Den"

T7 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text15")
T7.Text = "TOTAL : " & TextBox2.Text & " Den"

T8 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text16")
T8.Text = TextBox1.Text & " F"

T9 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text18")
T9.Text = ComboBox1.Text

T10 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text21")
T10.Text = "Adresa : " & TextBox16.Text

T11 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text20")
T11.Text = "Tel/Fax : " & TextBox17.Text

T12 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text19")
T12.Text = "Danocen Broj : " & TextBox18.Text

T13 = rptDoc.ReportDefinition.Sections(1).ReportObjects("Text22")
T13.Text = "Z-Smetka : " & TextBox19.Text

rptDoc.SetDataSource(ds)
Me.CrystalReportViewer1.ReportSource = rptDoc

"THE CODE TO PRINT IT DIRECTLY TO SELECTED PRINTER NAME SAVED IN A TEXTBOX"

End Sub

But is there a way to print it directly when i pres a button to show the report in reportviewer button to
print it directly to the alredy selected printer name saved in a textbox.

I have putet a print dialog and when i pres the buton "select printer" then the printdialog1 show and
you select the printer and the name of that selected printer is saved in a textbox and to the database
so when i always when gona open my aplication the printer name will apear in that textbox.
So what i want is directkly to print this report to the selected printer name in that textbox.for example
the name of the printer is showed in the textbox10.text.

Reply With Quote

Quick Navigation Visual Basic .NET Top

Previous Thread | Next Thread

VBForums Visual Basic Visual Basic .NET VS 2008 Send textbox text to crystal report

Posting Permissions
You may not post new threads BB code is On
You may not post replies Smilies are On
You may not post attachments [IMG] code is On
You may not edit your posts [VIDEO] code is On
HTML code is Off
Forum Rules

Contact Us VB Forums Top

http://www.vbforums.com/showthread.php?742963-Send-textbox-text-to-crystal-report 3/4
12/2/2014 VS 2008 Send textbox text to crystal report-VBForums

Acceptable Use Policy

Property of Quinstreet Enterprise.


Terms of Service | Licensing & Reprints | Privacy Policy | Advertise
Copyright 2014 QuinStreet Inc. All Rights Reserved.
All times are GMT -5. The time now is 08:46 PM.

http://www.vbforums.com/showthread.php?742963-Send-textbox-text-to-crystal-report 4/4

S-ar putea să vă placă și