Search Results

Search found 1 results on 1 pages for 'user1824343'.

Page 1/1 | 1 

  • how do i make the app take correct input..?

    - by user1824343
    This is my windows app's one layout which converts Celsius to Fahrenheit. The problem is that when I try to input the temperature it shows some junk(for eg: if i enter '3' it displayin '3.0000009') and sometimes its even showing stack overflow exception. The output is also not shown properly : cel.text is the textbox for celsius. fahre.text is the textbox for fahrenheit. namespace PanoramaApp1 { public partial class FahretoCel : PhoneApplicationPage { public FahretoCel() { InitializeComponent(); } private void fahre_TextChanged(object sender, TextChangedEventArgs e) { if (fahre.Text != "") { try { double F = Convert.ToDouble(fahre.Text); cel.Text = "" + ((5.0/9.0) * (F - 32)) ; //this is conversion expression } catch (FormatException) { fahre.Text = ""; cel.Text = ""; } } else { cel.Text = ""; } } private void cel_TextChanged(object sender, TextChangedEventArgs e) { if (cel.Text != "") { try { Double c = Convert.ToDouble(cel.Text); fahre.Text = "" + ((c *(9.0 / 5.0 )) + 32); } catch (FormatException) { fahre.Text = ""; cel.Text = ""; } } else { fahre.Text = ""; } } } }

    Read the article

1