views:

180

answers:

2

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?

+4  A: 

Did you try:

System.Windows.Forms.MessageBox.Show(myGame.P2.Money.ToString());
ongle
+2  A: 

Have you tried

System.Windows.Forms.MessageBox.Show(myGame.P2.Money.ToString());

?

Bruno Reis