如果我获得的价值很大,我可以在没有任何科学记数法的情况下获得浮动值 [英] Can I Get A Float Value Without Any Scientific Notation If The Value I Get Is Large

查看:73
本文介绍了如果我获得的价值很大,我可以在没有任何科学记数法的情况下获得浮动值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在另一页上分配大浮点数我试图分配给其他浮动因为浮动值中的科学记法而给我一个错误。如何在没有任何科学记数法的情况下获得浮动值





if i assign large float number on the other page im trying to assigning to other float which is throwing me a error because of scientific notation in that float value. how to get a float value without any scientific notation


if (Request.QueryString["Amount"] != null)
           {
               float Amount = float.Parse(Request.QueryString["Amount"].ToString());
               ((TextBox)fv_brokerpayment.FindControl("PaidAmountTextBox")).Text = Amount.ToString();

               int PaymentID = crudobj.GenerateID("Payment_tbl");
               ((TextBox)fv_brokerpayment.FindControl("PaymentIdTextBox")).Text = PaymentID.ToString();
               ((TextBox)fv_brokerpayment.FindControl("Ref_BrokerIdTextBox")).Text = Session["BrokerRefID"].ToString();
               ((TextBox)fv_brokerpayment.FindControl("PaidDateTextBox")).Text = DateTime.Now.ToString();
           }







我在这行收到错误






im getting error in this line

Quote:

float Amount = float.Parse(Request.QueryString [Amount]。ToString()) ;

float Amount = float.Parse(Request.QueryString["Amount"].ToString());





//例如:



//eg:

Quote:

{Amount = 1.111111E + 07}

{Amount=1.111111E+07}

推荐答案





你能用这种方式试试吗:

Hi,

Can you try it this way:
float Amount = float.Parse(Request.QueryString["Amount"].ToString(), System.Globalization.NumberStyles.Float);





但是,如果值太大,就像

这样使用它:



But in case, the value is too large, like
Use it this way:

double Amount = double.Parse("1.111111E+07", System.Globalization.NumberStyles.Float);





问候,

Praneet



Regards,
Praneet


我很想替换这个



I'd be tempted to replace this

float Amount = float.Parse(Request.QueryString["Amount"].ToString());





with < br $>




with

float Amount = float.Parse(Request.QueryString["Amount"].ToString(), System.Globalization.NumberStyles.Float);





开头 - 但要注意,如果当前文化的小数点分隔符不是'。'那么可能会失败 - 所以你可能需要使用下面这个表格





to start with - but be aware, that's likely to fail if the current culture's decimal point separator isn't '.' - so you might need to use this form below instead

float Amount = float.Parse(Request.QueryString["Amount"].ToString(),System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture);





[edit] btw,给我们错误信息可能也有很有用[/ edit]



[edit] btw, giving us the error message might also have been useful [/edit]


这篇关于如果我获得的价值很大,我可以在没有任何科学记数法的情况下获得浮动值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆