Re: Float to string conversion in C#

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Well I worked it out in the end - because I was returning the result of
a Yahoo! maps api call (which is definitely a float type) into the text
field fromLat before the call to float.Parse, I had assumed that the
value was at that point "in" the text field. It turns out that until
the server side code completes, the textfield doesnt seem to actually
"get" the value passed into it, so at the point I was calling the
float.Parse the text field had nothing in it, even though I do nothing
to change it between then and when the textfield appears on the screen
with the float value clearly inside the text field. Seems rather
bizarre behaviour, but I had never used c# server side code behind an
asp.net page before this so I didnt understand how the text fields were
assigned values.

Sorry - I guess I should have checked beforehand that the float value
really was in this.fromLat.Text!! ;-)

Having said that, the error message completely threw me, and I dont
like the error message given what I was trying to do - it was nothing
to do with DateTime types, so no wonder I was totally confused!
Microsoft should come up with something better than that I feel. Why
do they assume that a float is a DateTime????

Thanks again guys..

.



Relevant Pages

  • Re: How do I rotate a bitmap fast with high quality?
    ... and change float to int using fixed point algorithm. ... I want to know a new algorithm, with high quality and faster speed. ... >though,I could change double type to float type, ...
    (comp.graphics.algorithms)
  • Re: max / min / smallest float value on Python 2.5
    ... smallest positive float I'm using, ... float type is build upon C's double precision float type on both 32 and ... The simple precision 32bit float type isn't used. ... four-digit mantissa, and for convenience ignore negative mantissas. ...
    (comp.lang.python)
  • Re: How to byte swap an IEEE Float?
    ... > convert first to a float type of that length, ... All the data in the file are of 32 bits float so that should be ok. ... fairly common task. ... better idea than handling it as a string. ...
    (comp.lang.ada)
  • Re: Passing A Float In WParam or LParam of Windows Message
    ... Based on my experience, m.LParam is of type "IntPtr", however, it should be no problem to convert it into Single if you are sure that this message's lParam is actually float type. ...
    (microsoft.public.dotnet.languages.csharp)
  • Best way to Import data from EXCEL using a TSQL
    ... FloatField - Float. ... This method gives me the following error message. ... "Error converting data type nvarchar to float." ... So i then change the data type in the table to VarChar on the Fload field ...
    (microsoft.public.sqlserver.odbc)