Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
DateTime dt1 = Calendar2.SelectedDate;
            DateTime dt2 = Calendar1.SelectedDate;
            TimeSpan ts = dt1 - dt2;           
            double days = ts.Days;
            txtDays.Text = days.ToString();
            double res = days - 1;
            double amt = Convert.ToDouble(txtAmt.Text);
            double res1 = amt * res;
            double amtperday = Convert.ToDouble(txtAmtPerDay.Text);
            double res2 = days * amtperday;
            double tot = res1 + res2;
            txtTotAmt.Text = tot.ToString();
Posted
Updated 24-Feb-13 2:15am
v2

1 solution

Use Double.TryParse Method (String, Double%)[^] method instead of Convert.ToDouble Method (String)[^].

My personal opinion: As I looked into your previous questions, it is very sad, that you are using CP instead of trying to google first.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Mar-13 15:35pm    
Agree, a 5.
OP re-posted this exact question again, which is the abuse. We need to report accounts for systematic abuse like that.
OP also posted two fake answers. I'm not going to report it to the abuse watch forum just yet, because forum votes may easily ban the account, but I want just warn Gilbertinino.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900