here is the situation
http://i962.photobucket.com/albums/ae103/kashyaprakesh/misc/denominationwindow.jpg
i have text boxes to left which accepts denomination values and other text box to right gives the total value for eg in 1000's label's left textbox if i put value as 5 then to right the value is 5000.
i used lostFocus event handler to do this .. but is it necessary to do the lost focus event handler for each and every textbox?? there will surely be an other way...
below is the code i use
private void textBox6_Leave(object sender, EventArgs e) {
MessageBox.Show(e.ToString());
if (textBox6.Text == "")
{
string y = "0";
textBox6.Text = y;
textBox8.Text = y;
}
else
{
textBox8.Text = populateTotalAmount(textBox6.Text, 1000);
}
textBox8.ReadOnly = true;
}
private string populateTotalAmount(string denominations, int value)
{
int totalVal = Int32.Parse(denominations) * value;
return totalVal.ToString();
}
i would like to create a generic event handler which works on LostFocus event and also i need to pass different value(ie, 500,100, etc etc etc) so that i can use that value to send it populateTotalAmount function....
can some one pls help me with this.. ill be really thankful.....