I anm new to the crystal report i wat to get it when i save the information of patient in windows application.when i save the information i am using the new form and passing the value from one form to new one .
private void btnPaymentSave_Click(object sender, EventArgs e)
{
int MaxId = 0;
da.OpenConnection();
Info = new PatientInfo(da);
PatientPayment = new Payment();
int PaySuccess = 0;
try
{
if (txtPatientName.Text == "")
{
MessageBox.Show("Please Enter The Patient Name");
txtPatientName.Focus();
}
if ((txtPaid.Text == "")||(txtPaid.Text=="0"))
{
MessageBox.Show("Please Enter the Paid Amount");
txtPaid.Focus();
}
if ((txtPatientName.Text != "") && (txtPaid.Text != "") && (txtPaid.Text != "0"))
{
Info = Info.GetIdOfPatient(txtPatientName.Text.Trim());
PatientPayment.PatientId = Info.ID;
PatientPayment.PaidAmount = Convert.ToDecimal(txtPaid.Text);
PatientPayment.PaymentDate = DateTime.Now.Date;
PaySuccess = PatientPayment.Add(PatientPayment);
if (PaySuccess == 1)
{
MessageBox.Show("Patient Payment Saved Successfully");
ClearAll();
}
int id = Info.ID;
MaxId = PatientPayment.GetMaxID(Info.ID);
frmPatientPaymentReport PaymentRepo = new frmPatientPaymentReport(Info.ID,MaxId); -----from here i am passing the id and max id to the new form on which i do have crystal viewer
PaymentRepo.ShowDialog();
PrintReport();
}
}
catch(Exception ex) { }
}
suppose this is PatientPayment Form and
On new Form I am Doing the Code as
public partial class frmPatientPaymentReport : SForm
{
RptPatientPaymentReport PatientPay;
int PatientID = 0;
int MaxID = 0;
public frmPatientPaymentReport()
{
InitializeComponent();
}
public frmPatientPaymentReport(int id,int MaxId) //here I am Collecting it and assigning it.
{
this.PatientID = id;
this.MaxID = MaxId;
Print(MaxId);
}
private void Print(int id)
{
PatientPay = new RptPatientPaymentReport();
try
{
if (PatientPay != null)
{
PatientPay.SetParameterValue("MaxID", id);
CrpViewerPatientPayment.ReportSource = PatientPay; //At this Point i am getting that error
CrpViewerPatientPayment.Refresh();
}
}
catch (Exception ex)
{ }
}
and at database expert i do have paid amount field i just want to write formula field to print to convert int to words so
1]how can i solve above issue??
2] how can i write formula field to print the amount into receipt??
Member
566 Points
398 Posts
Object Reference Not Set To An Instance Of An Object in Crystal Report
Jul 05, 2014 01:32 AM|bhushan_microsoft|LINK
I anm new to the crystal report i wat to get it when i save the information of patient in windows application.when i save the information i am using the new form and passing the value from one form to new one .
suppose this is PatientPayment Form and
On new Form I am Doing the Code as
and at database expert i do have paid amount field i just want to write formula field to print to convert int to words so
1]how can i solve above issue??
2] how can i write formula field to print the amount into receipt??
thanks in advance
Member
566 Points
398 Posts
Re: Object Reference Not Set To An Instance Of An Object in Crystal Report
Jul 05, 2014 04:41 AM|bhushan_microsoft|LINK
I got the solution of my problem...solved by myself