James Cooper

James Cooper

  • NA
  • 3
  • 2k

WPF-Radio button and checkbox validation using if statements

May 17 2015 11:55 PM
Hi i am quite new to programming so the syntax  is still very confusing for me.

My problem is I want to add an option when the user checks radio button(warranty) (adding 10% to the subAmount using an if statement.
I am using...
 
if (threeYearRadioButton.IsChecked == true)
{
threeYearRadioButton = threeYearWarranty;
}
 
threeYearRadioButton(is the name of the radio button in my xaml code)
double threeYearWarranty = 0.1d; (is the name i have used to define in my cs code)
 
If the user checks one year there is no charge on top of the subAmount.
If three years is selected then 10% is added on top of the SubAmount and
five years = 20% added on top of the subAmount.
 
 I am having the same issue with checkboxes:
If the user checks "totalWindowTinting", then $150 is added to the subAmount.        int totalWindowTinting = 150;
If the user does not check the window tinting box then there will be no additional price added to the SubAmount.
 
I know i need to use an if statement, but it just comes up with errors wen i  start using the ISChecked property.
 
please help!
 
 
 
Thanks,
 
James
 
 
 
 
 
 

Answers (3)