to pass textbox value to crystal report without using database
-
Friday, September 25, 2009 10:54 AMHi ,I am trying to pass data from C# form to crystal report ....I am not at all using database to get the data ....
In c # form i am having one text box and one button.....i added one crystal report to my application....To crystal report in page header i added one text box item ...After running application i am adding some text in text box and then clicking the button,the data which i typed in text box must reflect in crystal report.......Please help me ,I am very new to crystal reports and .netregards:Ravinder Reddy
All Replies
-
Friday, September 25, 2009 11:22 AMHi Ravinder,
Check this Link .... this will be helpfull to you...
http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/9dad1e4e-7923-4e5f-a736-dc03d634cb25
Sharp Eyes
Sharp Eyes -
Friday, September 25, 2009 1:56 PMThanks for post it is useful to meActually I am looking for bill printing application for a firm where i want to enter the goods details and there prices in a table format .....the User will enter the goods in the C# form and just print th bill after entering all the goods list for customer.....Can u help me out with some simple code where i can get a billing application ......ThanksRegards:Ravinder
-
Friday, September 25, 2009 2:34 PM
Are you storing the data in the database?
If not are you storing the data in a datagridview?
If you are storing the data in a datagridview then check this link?
http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/8dc49602-7f05-41b1-90e9-1bdd501c77b6
This link will explain you how to create a crystal report from datagridview....
The same you can use to create crystal report from your form....
If you need further clarification post some of your code here so that we can understand what you want to do....
Sharp Eyes- Marked As Answer by Harry ZhuModerator Friday, October 02, 2009 2:11 AM
-
Monday, October 05, 2009 1:45 PM
Hi,If you don't have any database.Then just use Dataset.Add New Item---->DataSet1.xsd.After right click on dataset Add--->Columns--->Create some column-->On runtime send your data from form to this dataset.Then on your crystal report select ------> Database Expert ------> ADO.Net Dataset--->DataSet1.get the fields from their.Drop fields on crystal report.then add code of you code behindsee the complete tutorial--> http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-without-database.htmDataSet1 ds = new DataSet1(); DataTable t = ds.Tables.Add("Items"); t.Columns.Add("id", Type.GetType("System.Int32")); t.Columns.Add("Item", Type.GetType("System.String")); DataRow r ; int i = 0; for (i = 0; i <= 9; i++) { r = t.NewRow(); r["id"] = i; r["Item"] = "Item" + i; t.Rows.Add(r); } CrystalReport1 objRpt = new CrystalReport1(); objRpt.SetDataSource(ds.Tables[1]); crystalReportViewer1.ReportSource = objRpt; crystalReportViewer1.Refresh();thanks
prashant
-
Thursday, July 08, 2010 2:58 PM
Hi what i undestand is that, you need to print value of a windows textbox1 in creports and that value comes from user or data base is that so ?then here is the very simple solution for it.Just a simple logic here.all you need to do is :
1.Frst create a parameter in the paraeterField in the DatabaseFileds, name it crParam.
2.ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(@"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\CrystalReportsWithParam\CrystalReportsWithParam\CrystalReportsWithParam\CrystalReport1.rpt");
ParameterFieldDefinitions crParameterFieldDefinitions ;
ParameterFieldDefinition crParameterFieldDefinition ;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();crParameterDiscreteValue.Value = textBox1.Text;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields ;
crParameterFieldDefinition = crParameterFieldDefinitions["crParam"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();now drag and drop that paramter crParam on crystalReport where ever you want to display in
that's it
Do reply to me if this code works for your
thank you
Happy Coding
Hari

