Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a Messagebox display a variable

I want a MessageBox to display an int variable, can anybody help?

like image 428
user1350180 Avatar asked Apr 22 '12 22:04

user1350180


People also ask

How do you use variables in MessageBox?

with VBA, follow these steps: Create a message box with the MsgBox function (MsgBox(…)). Specify the buttons to be displayed in the message box (Buttons:=ButtonsExpression). Assign the value returned by the MsgBox function to a variable (Variable = MsgBox(…)).

How do I show a variable in VBA?

In the VBA editor go to the View menu and click on Locals Window. Each time F8 is pressed one line of VBA is executed. When the range MyRange is set, you can see that values appear for it in the Locals window. By examining the MyRange object you can drill down to see the values in it.

How do you show a box of messages in an Excel spreadsheet?

Expand the contents of the workbook and right click on Microsoft Excel Objects. Hover your cursor over Insert and select Module from the menu that appears. This will create a new blank module. Now we can start creating our first message box.


3 Answers

You want to use the MessageBox.Show() method

int num = 0;
MessageBox.Show(num.ToString());
like image 106
jb. Avatar answered Sep 20 '22 13:09

jb.


Use string formatting with the message box:

int courseId = 0;

DialogResult result = MessageBox.Show(string.Format("Print Course No {0} ?", courseId), "Print Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
like image 32
Ashraf Sada Avatar answered Sep 23 '22 13:09

Ashraf Sada


jb's answer is correct, if you need some more information MSDN has full documentation at: http://msdn.microsoft.com/en-us/library/aa984357(v=vs.71).aspx

For simple library matters, MSDN nearly always has excellent, easy to understand documentation.

like image 22
Frater Avatar answered Sep 22 '22 13:09

Frater