I have done my project and now i am just facing a little issue and I don't know how to solve issue is on Form_Load
it's get value from database and show in Listbox
it's OK but it's not add .00
after item price please help me and tell me how can i add this. I am using this coding:
txtDisplay.Text = "Return/" + "Receipt No:" + Return_Form.setalueforText011;
label1.Text = Return_Form.setalueforText011;
OleDbConnection VCON = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Restaurant.accdb");
DataSet dsa = new DataSet();
DataTable dt = new DataTable();
dsa.Tables.Add(dt);
OleDbDataAdapter da = new OleDbDataAdapter();
da = new OleDbDataAdapter("SELECT [Column1],[Column2],[Column3] from [Total] Where [Receipt No] = " + label1.Text + "", VCON);
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
// Create and initialize a new tblProduct from the datatable row
tblProduct current = new tblProduct();
current.productName = dt.Rows[i]["Column2"].ToString();
current.productPrice = Convert.ToDecimal(Math.Round(Convert.ToDecimal(dt.Rows[i]["Column1"].ToString())));
// Add to your list of products
products.Add(current);
// This line is wrong because you overwrite the value at each loop
label3.Text = dt.Rows[i]["Column3"].ToString();
// Sum the price of the current tblProduct
Total += (decimal)current.productPrice;
}
// Outside the loop update your total label
textBox59.Text = "Rs: " + String.Format("{0:}", Total+".00");
VCON.Close();
Please tell me how can I add .00 after item price.