How to display integers in messagebox in Visual C#?
-
05-07-2019 - |
Question
I am trying to use a messagebox to debug a Visual C# program. When I click a button I want a simple messagebox to popup and display the values of several integer variables. This is what I have
System.Windows.Forms.MessageBox.Show(myGame.P2.Money);
However the variable Money is an integer, and so I get this error:
Argument '1': cannot convert from 'int' to 'string'
How do I get this to work?
Solution
Did you try:
System.Windows.Forms.MessageBox.Show(myGame.P2.Money.ToString());
OTHER TIPS
Have you tried
System.Windows.Forms.MessageBox.Show(myGame.P2.Money.ToString());
?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow