在文本框中显示数字时出现问题 [英] Problem to display numbers in textbox
本文介绍了在文本框中显示数字时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从网页获取文本框的值,并将数字值显示到文本框.所以我给以下
I want get the values of textboxes from webpage and displays the numeric values to textboxes. So i give following
txttot.Text=convert.Todouble(txtamt.Text)+convert.Todouble(txttax.Text)
但是错误是将隐式转换为String的两倍"
所以我给以下
But the error is "Conversion implicity double to String
So i give following
double tot;
tot=convert.Todouble(txtamt.Text)+convert.Todouble(txttax.Text)
txttot.Text=tot;
但这不起作用
请帮助我
But it is not working
Please help me
推荐答案
尝试一下:
Try this:
double a = double.Parse(txtamt.Text.ToString()) + double.Parse(txttax.Text.ToString());
txttot.Text = a.ToString();
double tot;
tot=convert.Todouble(txtamt.Text)+convert.Todouble(txttax.Text)
txttot.Text=tot.Tostring();
注意代码段末尾的tostring()
Notice the tostring() in the very end of code segment
hi,
试试这个,
try this,
txttot.Text=convert.ToString(convert.Todouble(txtamt.Text)+convert.Todouble(txttax.Text));
希望这对你有用.
hope this works for u..
这篇关于在文本框中显示数字时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文