I have created a windows application using C#. the problem is fairly simple. I doono how to refer to the Application path in c#. In Vb we can use App.path to refer to the Application path
My C# code for opening a report is as
public partial class frmSpaBill : Form
{
string report_file =@"F:\Spa n saloon\Spa n Saloon\Spa n Saloon\SpaServiceBill.rpt";
ReportDocument ReportDoc = new ReportDocument();
public frmSpaBill()
{
InitializeComponent();
}
private void frmSpaBill_Load(object sender, EventArgs e)
{
ReportDoc.Load(report_file);
crystalReportViewer1.ReportSource = ReportDoc;
makeReport(report_file);
SetParamValue("@date",BillVariables.date);
SetParamValue("@timein", BillVariables.timein);
SetParamValue("@timeout", BillVariables.timeout);
SetParamValue("@CustID", BillVariables.custID);
SetParamValue("@CustName", BillVariables.custName);
SetParamValue("@SpaID", BillVariables.ServID);
SetParamValue("@SpaServiceName", BillVariables.ServiceName);
SetParamValue("@Description", BillVariables.Description.Replace("\r\n", "__"));
SetParamValue("@Duration", BillVariables.Duration);
SetParamValue("@Price", BillVariables.Price);
crystalReportViewer1.ReportSource = ReportDoc;
}
private void makeReport(string ReportFile)
{
ReportDoc.Load(ReportFile);
crystalReportViewer1.ReportSource = ReportDoc;
}
private void SetParamValue(string paramName, string paramValue)
{
for (int i = 0; i < ReportDoc.DataDefinition.FormulaFields.Count; i++)
if (ReportDoc.DataDefinition.FormulaFields[i].FormulaName == "{" + paramName + "}")
ReportDoc.DataDefinition.FormulaFields[i].Text = "\""+paramValue+"\"" ;
}
}
}
the problem is thet if i move my project to another directory i have to modify the path string..
Can anyone tell me how to refer in c# like in vb. ive searched the internet but have not seen one yet