User-1901014284 posted
Hi,
I have the below code for a calculation to be displayed in a label. The issue is with the WorkDurationHrsTextBoxMonthly.Text not outputting the value to conhrs. I think this would be due to the value of the textbox being a TimeSpan but I am not sure
how best to parse the value so I can display the result in a label.
WorkDurationHrsTextBoxMonthly.Text = 6:54
double conhrs, HrsPerMon;
double.TryParse(WorkDurationHrsTextBoxMonthly.Text, out conhrs); //Does not pass the value from WorkDurationHrsTextBoxMonthly.Text to conhrs
double.TryParse(WorkingHoursPerYearLabelMonthly.Text, out HrsPerMon);
double Perc = 100.00 * conhrs / HrsPerMon;
ConHrsUtilLabelMonthly.Text = Perc.ToString("c").Remove(0, 1); //Calculates the total and displays in label