Reset textfield based on other textfields values
hello,
1. I want to populate totaltextfield value based on other textfields at runtime e.g. if i enter 1 in txtbox1 then totaltextfield should show 1 rather then if i have 5 textboxes entering value in each of them and then getting totaltextfield populated
2. I want to reset my totaltextfield value when i change values in some textfields
what i do basically if i enter some values in textfields e.g. 1, 2 etc and then later changing them then the totaltxtfield value do not get reset properly
Below is some piece of code i am using:
private void frdtxtBox_TextChanged(object sender, EventArgs e)
{
if (Convert.ToDecimal(frdtxtBox.Text) < 0 || Convert.ToDecimal(frdtxtBox.Text) > 1)
{
MessageBox.Show("Please enter the number between 0-1");
frdtxtBox.Clear();
return;//this stops the method processing any further as you wouldn't want to calculateTime if the number is invalid
}
calculateTime();
}
....
..
public void calculateTime()
{
decimal total = Decimal.Parse(monTxtBox.Text) + Decimal.Parse(tuesTxtBox.Text) + Decimal.Parse(wedTxtBox.Text) + Decimal.Parse(thurTxtBox.Text) + Decimal.Parse(frdtxtBox.Text);
totalTimetxtBox.Text = total.ToString();
}
thanks