Hi,
I m sending u the method that how do it. It’s DateOn parameter
These are the steps
Go to ur Report Designer View where u have already created some fields
Also add a textbox(give name PtextBox) for ur parameter
Below these fields R.C(right click) and select Report Parameter a window will open
There will be a button name as Add click it
And then give DateOn in the Name field and DateTime in the DataType field
And also DateOn in the Prompt field
Now go on ur PtextBox R.C and go its property
A window will open click on Expression button
Then a new window open like this below
Select Parameter then then double click on DateOn
A statement =Para…………….. appeared then click Ok
Like this u can add parameter in your report
Now the code behind the form/Page like this
// include the following namespaces
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using Microsoft.Reporting.WinForms.ReportDataSourceCollection;
then write this code on Button Click which is on ur form name GoLoad
private void GoLoad_Click(object sender, System.EventArgs e)
{
// Hare I used binding source and fill the data by DateOn
// TrialBalanceRPT i.e my Dataset name
// CtrlTrialBalance i.e my table name
//this.DateTimePicker1.Value i.e for DateOn Parameter
this.CtrlTrialBalanceTableAdapter.Fill (this.TrialBalanceRPT.CtrlTrialBalance, this.DateTimePicker1.Value);
// mParameters(0)hare u can use 0,1,2…. How much parameter u want
ReportParameter[] mParameters = new ReportParameter[1];
mParameters(0) = new Microsoft.Reporting.WinForms.ReportParameter("Dateon", this.DateTimePicker1.Value);
this.ReportViewer1.LocalReport.SetParameters(mParameters);
this.ReportViewer1.ZoomPercent = 100;
this.ReportViewer1.RefreshReport();
}
Actually I made it in window application using VB.NET and the code I convert in c# but bellow I m giving vb.net code if any problem then follow this code
I think u will understand it and achieve your goal easily
If udiscuss any thing about it then please
Ok
Allah hafiz
Imports System.Windows.Forms
Imports Microsoft.Reporting.WinForms
Imports Microsoft.Reporting.WinForms.ReportDataSourceCollection
Public Class CtrlTrial
Private Sub GoLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoLoad.Click
'TODO: This line of code loads data into the 'TrialBalanceRPT.CtrlTrialBalance' table. You can move, or remove it, as needed.
Me.CtrlTrialBalanceTableAdapter.Fill(Me.TrialBalanceRPT.CtrlTrialBalance, Me.DateTimePicker1.Value)
'Me.ReportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.FullPage
Dim mParameters(0) As ReportParameter
mParameters(0) = New Microsoft.Reporting.WinForms.ReportParameter("Dateon", Me.DateTimePicker1.Value)
Me.ReportViewer1.LocalReport.SetParameters(mParameters)
Me.ReportViewer1.ZoomPercent = 100
Me.ReportViewer1.RefreshReport()
End Sub
End Class