Thursday, February 4, 2016

C# Crystal Report Tutorial In Urdu - How to use Stored Procedure in Crystal Report


Code here

Form - Form1.cs code
using System;
using System.Windows.Forms;

namespace CrystalReportDemo2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void ExitButton_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void ShowReport1Button_Click(object sender, EventArgs e)
        {
            ReportForm reportForm = new ReportForm();
            reportForm.LoadReport = @"Reports\Report1.rpt";
            reportForm.ShowDialog();
        }

        private void ShowReport2Button_Click(object sender, EventArgs e)
        {
            ReportForm reportForm = new ReportForm();
            reportForm.LoadReport = @"Reports\Report2.rpt";
            reportForm.ShowDialog();
        }
    }
}
Form - ReportForm.cs code
using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;

namespace CrystalReportDemo2
{
    public partial class ReportForm : Form
    {
        public ReportForm()
        {
            InitializeComponent();
        }

        public string LoadReport { get; set; }

        private void ReportForm_Load(object sender, EventArgs e)
        {
            ShowReport(this.LoadReport);
        }

        private void ShowReport(string report)
        {
            ReportDocument rdoc = new ReportDocument();

            rdoc.Load(report);

            ReportCrystalReportViewer.ReportSource = rdoc;
        }
    }
}

3 comments:

  1. Nice...really nice work...ALLAH bless you

    ReplyDelete
  2. Asslam-o-Alaekum Sir,
    Umeed karta hun kay aap khairiat say hun gay, Sir aik question hai crytsal reporting kay bary mai:
    Question : Agar aik project main 5 ya 10 crystal reports hun to un sab ky liye alaida alaida forms design karna behtar hai, ya sab ko aik hi form main show karwayein ye behtar hai????
    Please Jawaban Mashkoor farmayein.

    ReplyDelete