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
Shane Nicholson
NA
36
1.7k
C# How to use a textbox variable
Nov 9 2020 3:35 PM
Good day everyone,
First of all, thank you for taking the time to read my request, it means alot.
I have created a windows form on VB 2019.
When a user puts a number into textbox 5, I want the following equation to be calculated and the total displayed in Textbox8.
The below works to some level, but if the number is negative (example: -200) it does not work.
Also if the user tries to clear the text box, it always crashes with the same error " System.FormatException: 'Input string was not in a correct format.'
My guess is this has something to do with the variable I am using and cannot recognise a character.
Thanks again people, I really appreciate your time and expertise.
private
void
textBox5_TextChanged(
object
sender, EventArgs e)
{
double
firstbox;
double
answer;
firstbox =
double
.Parse(textBox5.Text);
answer = firstbox / 1000 * 3.18141 * 2.3 * 1.19;
textBox8.Text = (answer.ToString());
}
Reply
Answers (
2
)
Edit Word Document at client side and update back to server side appli
Duplicate JSON classes