I'm creating a donation application that reads the input in a textbox, converts it to a double. Then using the method operatingCost
, it should take that converted double and divide it by 17% (operating fees). Currently in the method, I have the variable dontationBFees
coming in and then being divided by 17 and creating a new variable afterFees
. The problem I'm having is that I need to pass by ref in this project and I cant seem to access the afterFees
variable. I need to get the ref afterFees
and have it displayed to my afterFeesBox
. Also I have this method inside my button on_click
. Any help will be greatly appreciated. Below is my code:
private Double donationBFees = 0;
private void button1_Click(object sender, EventArgs e)
{
String donationBeforeFees;
Double aFees;
String totalDonationRaised;
donationBeforeFees = donationBox.Text;
donationBFees = System.Convert.ToDouble(donationBeforeFees);
void operatingCost(ref double afterFees)
{
afterFees = (donationBFees / 17);
}
afterFeesBox.Text = operatingCost(ref afterFees);
}