I need help on how can I compute for the Basic Pay which is the Rate/Day * No. of days worked.
How can I get the values of every position code so that I can multiply it to the No. of Days Worked.
For example when I enter position code A, the rate/day is 500. That should do 500 * 2 so that my basic pay would come out as 1000.
I need help please. Thanks in advance!!
On your NumericUpDown
control, there's an event called ValueChanged
, you can use that to compute the basic pay of the employee based on your ComboBox value.
You can use this code to automatically compute the basic bay
of your employee base on the number of days worked
private void NumericUpDown1_ValueChanged(Object sender, EventArgs e)
{
if(cmbPositionCode.SelectedItem == "Code A")
txtBasicPay.Text = 500 * NumericUpDown1.Value;
else if(cmbPositionCode.SelectedItem == "Code B")
txtBasicPay.Text = 600 * NumericUpDown1.Value;
...
}
Edit:
So you want to use the compute
button to compute the basic pay which is almost the same as above but you will put the code in the Click
event of your Compute
button
private void btnCompute_Click(Object sender, EventArgs e)
{
if(cmbPositionCode.SelectedItem == "Code A")
txtBasicPay.Text = 500 * NumericUpDown1.Value;
else if(cmbPositionCode.SelectedItem == "Code B")
txtBasicPay.Text = 600 * NumericUpDown1.Value;
...
}