Home > Net >  Solution: c #
Solution: c #

Time:09-19

For converting key input

CodePudding user response:

Implementation is as follows:
 
Double c=0, f;
Try//test input errors against an exception is thrown, but instead of regular,
{c=the Convert. ToDouble (textBox1. Text. The ToString ()); }//Convert conversion function, easy and convenient to use
The catch (Exception)
{
TextBox1. The Clear ();
Label2. Text="please enter a number!" ;
Label2. Visible=true;
return;//must be returned, otherwise will still perform the following code
};
F=1.8 * c + 32;//Celsius to Fahrenheit formula
Label2. Text="c" + c + "degrees into degrees Fahrenheit is:" + f;
Label2. Visible=true;


On the button1_Click click event,
  •  Tags:  
  • C#
  • Related