且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在C#中浮动到字符串转换

更新时间:2023-02-12 15:18:31

" mishj" ; < MI *** @ yahoo.com>在消息中写道

新闻:11 ********************** @ g43g2000cwa.googlegr oups.com ...
我得到一个例外,说明我不理解的日期时间类型




有错误你得到了通过实际告诉我们

错误消息是什么来轻松解决。一旦你这样做,这里有人会为你解决你的问题...


mishj,
>
尝试直接调用float.Parse(它与Single.Parse相同)


你能否发布异常消息+你想要的字符串

兑换?

-

HTH

Stoitcho Goutsev(100)


" mishj" < MI *** @ yahoo.com>在消息中写道

news:11 ********************** @ g43g2000cwa.googlegr oups.com ...
这里的其他人有与我相同的问题,但是他的回答没有解决我的问题,所以我希望有人可以帮助我(因为一些原因我无法回复与原版相同的线程)

我正在尝试将字符串转换为浮点数。它包含一个浮动值
但是当我尝试:

浮动myfloat = System.Convert.Toingle(strfloat);

我得到一个例外,说明日期我不理解的时间类型

帮助??

TIA
Mish
x



您好,mishj!


您可以在此处发布异常文本,如果可能的话,还可以发布strfloat值吗?


-

问候,Vadym Stetsyak

www: http://vadmyst.blogspot.com

Someone else on here had the same issue as I have but the response he
got didnt solve my problem so I hope someone can help me (for some
reason I was unable to reply on the same thread as the original)

I am trying to convert a string to a float. It contains a float value
but when I try:

float myfloat = System.Convert.ToSingle(strfloat);

I get an exception saying something about date time types that I dont
really understand

Help??

TIA
Mish
x

"mishj" <mi***@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I get an exception saying something about date time types that I dont
really understand



There error you''re getting is easily solved by actually telling us what the
error message is. As soon as you do that, somebody here will solve your
problem for you...


mishj,

Try to call directly float.Parse (it is the same as Single.Parse)

Can you please post the exception message + the string you are trying to
convert?
--
HTH
Stoitcho Goutsev (100)

"mishj" <mi***@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Someone else on here had the same issue as I have but the response he
got didnt solve my problem so I hope someone can help me (for some
reason I was unable to reply on the same thread as the original)

I am trying to convert a string to a float. It contains a float value
but when I try:

float myfloat = System.Convert.ToSingle(strfloat);

I get an exception saying something about date time types that I dont
really understand

Help??

TIA
Mish
x



Hello, mishj!

Can you post the exception text here and, if possible, strfloat value?

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com