Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
C#
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:

C#
double a1, a2, a3;
double.TryParse(txtTotal.Text, out a1);
double.TryParse(textBox73.Text, out a2);
a3 = a1 - a2;
MessageBox.Show(a3);
Posted
Updated 18-Dec-16 12:51pm
v2

1 solution

Hi Member 9983063,

This is not a problem at all. Just use ToString() in the message box as message box requires a string in it.
C#
MessageBox.Show(a3.ToString());
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900