当我减去2个文本框值时,我收到2个错误 [英] I am getting 2 errors when I subtract 2 textbox values
本文介绍了当我减去2个文本框值时,我收到2个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Guys,
当我减去2个文本框值并在消息框中显示结果时,我收到2个错误,所以我得到了这2个错误
错误 1175 最佳重载方法匹配 ' System.Windows.Forms.MessageBox.Show(string)'有一些无效的参数 20208 25 NewPOS
错误 1176 参数< span class =code-digit> 1 :无法从 ' =code-string> double'到' string'
我尝试了什么:
double a1,a2,a3;
double .TryParse(txtTotal.Text, out a1);
double .TryParse(textBox73.Text, out a2);
a3 = a1 - a2;
MessageBox.Show(a3);
解决方案
嗨会员9983063,
这根本不是问题。只需在消息框中使用ToString()
,因为消息框中需要一个字符串。
MessageBox.Show (a3.ToString());
Hello Guys,
I am getting 2 errors when i subtract 2 textbox values and shows result in message box so i get this 2 errors
Error 1175 The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string)' has some invalid arguments 20208 25 NewPOS
Error 1176 Argument 1: cannot convert from 'double' to 'string'
What I have tried:
double a1, a2, a3;
double.TryParse(txtTotal.Text, out a1);
double.TryParse(textBox73.Text, out a2);
a3 = a1 - a2;
MessageBox.Show(a3);
解决方案
Hi Member 9983063,
This is not a problem at all. Just useToString()
in the message box as message box requires a string in it.
MessageBox.Show(a3.ToString());
这篇关于当我减去2个文本框值时,我收到2个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文