TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gaetano D
NA
21
54.7k
Stupid problem
Dec 2 2010 4:15 PM
I have 3 text boxes that do a simple math equation, but I must be messing up my format. All Im doing is dividing the downpayment by the sales price. Then it should display the percentage of down payment in the downPaymentPercentTextBox. It works fine at first but when I clear out downPaymentTextbox I get this error:
ERROR MESSAGE WHEN DEBUGGING:
Input string was not in a correct format.
Here is the code... Please tell me what Im doing wrong.. The method starts when I put a number in the downPaymentTextBox and the error happens when I manually delete the input from the same box... Im lost
private
void
downPaymentTextBox_TextChanged(
object
sender,
EventArgs
e)
{
decimal
Price =
Convert
.ToDecimal(salesPriceTextBox.Text);
decimal
DownPay =
Convert
.ToDecimal(downPaymentTextBox.Text);
decimal
Percent = (DownPay / Price) * 100;
downPaymentPercentTextBox.Text =
Convert
.ToString(Percent);
}
ERROR MESSAGE WHEN DEBUGGING: Input string was not in a correct format.
Reply
Answers (
10
)
Working with computer hardware
Average and Standard Deviation in .NET?