Questions tagged [msgbox]

The MsgBox function is used in Visual Basic to display a dialog box to the user, wait for a button to be clicked and return the result to the caller. Use this question for using MsgBox specifically; for the .NET MessageBox class, use the "messagebox" tag instead.

Summary

The MsgBox function is exclusive to the Visual Basic programming language. It is commonly used in , or Visual Basic for Applications (), but can also be used in Visual Basic .NET for backwards compatibility. (However, in , it is recommended to use the MessageBox class from the .NET Framework instead.)

Function signature

As listed on MSDN:

Public Function MsgBox( _
   ByVal Prompt As Object, _
   Optional ByVal Buttons As MsgBoxStyle = MsgBoxStyle.OKOnly, _
   Optional ByVal Title As Object = Nothing _
) As MsgBoxResult
  • Prompt is used to set the text you want to display in the dialog box.
  • Buttons is used to set which buttons are displayed in the dialog box. If omitted, only the OK button is shown by default.
  • Title is used to set the title text for the dialog box. If omitted, the application name is displayed by default.

The return value is a numeric value indicating what action the user took in response to the dialog (i.e., which presented button was clicked).

Related tags

Useful questions

Links

403 questions
1
vote
2 answers

Message Box showing multiple times when progress bar complete in VB.NET

I am trying some with progress bar, but it's not showing popup correctly. When i use msgbox, its appears 100s of times and when I use form2 by replacing msgbox it keep showing even I close it. Public Class Form1 Private Sub Button2_Click(ByVal…
1
vote
1 answer

Change just the font size in AlertDialog

I know this has been already asked and even answered but i cannot figure out how customize AlertDialog. I write the following code and i get the following result as AlertDialog, that is what i want except the font size: it's the only thing that i…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
1
vote
0 answers

Getting easygui to self update info

Trying to get a self updating speedometer and clock working for my truck using gps. So far I have been able to get the read out that I want using easygui and msgbox but it is not self updating which will not help much on either application. Below…
1
vote
0 answers

subprocess.call runs Ctypes msgbox ok but also opens python.exe window

Running Python 3.4 on Windows platform. I want to use ctypes to kick out an error msgbox when no input is put into an input field. code is: if len(pet) == 0: subprocess.call("Python help.py") if pet == "cat": try: age = int(input("how…
madarelwof
  • 11
  • 4
1
vote
2 answers

How to MsgBox two values in a column?

I have TheMax and TheMin sub procedures to show the max/min values from the same column. How do I show both values in the same MsgBox? Original scripts: Sub ShowMax() Dim TheMax As Double TheMax = WorksheetFunction.Max (Range("A:A")) MsgBox…
Amanda S
  • 103
  • 1
  • 9
1
vote
2 answers

Don't wait for the answer just continue on batch

wscript C:\open.vbs ATTRIB -R -S -H "C:\add.txt" CD.>C:\add.txt goto end Hey guys I have a code like this. It prompts a window from open.vbs and It wait for the answer to continue. It is waiting for my answer. But I want it to prompt and just…
Rıdvan Çetin
  • 183
  • 5
  • 16
1
vote
2 answers

Possible to set message box buttons to not have a default button focus?

Is it possible to set it so there is no default button focus when a messagebox appears? This way, the message box will force the user to select Yes or No with a mouse. The MessageBoxDefaultButton (as seen below) only allows for the changing of the…
eternal
  • 99
  • 1
  • 4
  • 13
1
vote
2 answers

Messagebox in ASP.NET 3.5 with AJAX

I have a ASP.NET 3.5 web site with an AJAX update panel. I simply need to process some server side code and then issue a user prompt that says "Code processing complete". I know there is supposed to be support for Msgbox-esque methods in ASP.NET…
Unknown Coder
  • 6,625
  • 20
  • 79
  • 129
1
vote
1 answer

VB.Net and MB_TOPMOST for dialogs?

When left-clicking an application sitting minimized in the systray and displaying a messagebox, the dialog is out of focus the first time it's displayed, while it does have the focus the second time around. Google seems to say that the solution is…
Gulbahar
  • 5,343
  • 20
  • 70
  • 93
1
vote
1 answer

How do I perform a function in sequential dynamic ranges?

VBA newbie here. I did find some information out there about coding these loops but I'm having a very hard time figuring out if and/or how it applies to my specific needs, so thank you in advance for any help you can give. In order to QA…
jfkenne
  • 49
  • 2
  • 8
1
vote
0 answers

Making a Timeline/Linking Label Text to MsgBox

I am creating a timeline in Excel. For each date, I could have one or more event happen. Displaying the entire text of each event above the data point will be crowded. I will have short descriptions above each data point. I want to click the label…
Jax-El
  • 31
  • 1
  • 4
1
vote
1 answer

Why does this program need MsgBox?

Long story short: I'm trying to write an app that'll dump IE's history to a text file. Because I am lazy, I went searching for a preexisting library and found this beautiful project to build from: http://www.freevbcode.com/ShowCode.asp?ID=6702. …
AndrewBurton
  • 407
  • 7
  • 16
1
vote
2 answers

Why doesn't a MsgBox trigger a lost focus event VB.net?

I have a timer that each time displays a message box saying "Hello." I also have the code configured so whenever the window loses focus, it should stop the timer that keeps the boxes coming. However, they keep coming. I have tried a similar thing in…
Anonymous Penguin
  • 2,027
  • 4
  • 34
  • 49
1
vote
5 answers

How do I open multiple message boxes in vbs?

I know that if you input Do msgbox("This is a msg box") loop Then a msg box pops up that won't go away. I want multiple message boxes that you ARE able to close. How do I do this?
anon
1
vote
2 answers

msgbox in MATLAB

I want to show my output in a msgbox so I have used msgbox(num2str(output)) but I want to name each line, eg: Red 25 Green 52 Yellow 88 but when I try to do that it says Error using horzcat CAT arguments dimensions are not…
Chrysovalando
  • 97
  • 2
  • 8