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
Jay Lopez
NA
4
5.5k
How to handle a FormatException if the user inputs letters?
Sep 25 2016 10:54 PM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Project2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void convertTempButton_Click(object sender, EventArgs e)
{
int Fahrenheit;
int Celsius;
try
{
Fahrenheit = int.Parse(temperatureTextBox.Text);
}
catch (Exception ex)
{
MessageBox.Show("Please enter a Numeric Value");
}
Fahrenheit = int.Parse(temperatureTextBox.Text);
Celsius = (Fahrenheit - 32) * 5 / 9;
convertTempLabel.Text = Convert.ToString(Celsius) + " Celsius";
}
}
}
Reply
Answers (
1
)
The local data store is currently in use by another operatio
How to rectify cannot be opened because it is version 852.