ok, I will try to help you... 5/9 = 0, temp2/0+32 = infinity... So where is the problem? Well, 5 and 9 are both integers and the result can be just another integer... try 5/9.0 instead :) 2009/8/1 Rafael Anschau <[email protected]>
> > Thanks, new problem: > > double fhar=(temp2/(5/9))+32; > string fhr = fhar.ToString(); > MessageBox.Show(fhr); > > Messagebox show either 0 or infinity, never the number it is supposed > to show. Any thoughts ? > > > On Aug 1, 5:09 am, Cerebrus <[email protected]> wrote: > > Convert.ToInt32(string) internally calls Int32.Parse(string). > > > > It will throw a FormatException if the supplied string is not a valid > > number. > > > > On Aug 1, 7:00 am, Rafael Anschau <[email protected]> wrote: > > > > > private void button1_MouseClick(object sender, MouseEventArgs e) > > > { > > > > > string temp; > > > temp = textBox1.Text.ToString(); > > > double temp2; > > > temp2 = Convert.ToInt32(temp); > > > > > } > > > > > It compiles fine, but I get the runtime error "Format exception was > > > unhandled"" Input > > > string was not in a correct format" when the button is clicked. The > > > line it highlights is > > > temp2 = Convert.ToInt32(temp). > > > > >
