To be specific:
SIMSProduct Usercontrol
- cart.lbl_price.Text = lbl_totalprice.Text;
First the total of the customer bought is in lbl_totalprice.Text
Next that total is used to ProcessCart Form which is the cart.lbl_price.Text
- lbl_price.Text is now successfully getting the value of lbl_totalprice.Text
ProcessCart Form
- txt_amount(Textbox) is where user input the pay value of customer that should be subracted to the lbl_price.Text which is fail.
- lbl_totalprice.Text corresponds to the output of subracted lbl_price and txt_amount which is fail too
Note: lbl corresponds to Windows form Label
The problem is when i tried to input to my txt_amount, let's say i input 5000 and that 5000 is not subracting the value of lbl_price, also the lbl_totalprice is equal to what i type to txt_amount. Below these code, What I've done wrong here ?, something that i should not made? or i forgot something ?. I hope someone would be able to help in these matter. Thank you
public partial class SIMSProduct : UserControl { ITEMCount item; ProcessCart cart; public SIMSProduct() { InitializeComponent(); } private void btn_process_Click(object sender, EventArgs e) { cart = new ProcessCart(); cart.Show(); cart.lbl_price.Text = lbl_totalprice.Text; } } public partial class ProcessCart : Form { public ProcessCart() { InitializeComponent(); } private void txt_amount_TextChanged(object sender, EventArgs e) { decimal value1; decimal value2; decimal value3; if (decimal.TryParse(lbl_price.Text.Trim(), out value1)) { Total = Convert.ToInt32(lbl_price.Text); } if (decimal.TryParse(txt_amount.Text.Trim(), out value2)) { Paid = Convert.ToDecimal(txt_amount.Text); } if (decimal.TryParse(lbl_totalprice.Text.Trim(), out value3)) { Change = Convert.ToDecimal(lbl_totalprice.Text); } Change = Paid - Total; } }