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
votes
3 answers

How to display jquery msgBox after data is inserted to MySQL table using PHP

I want to show a message box when data is already inserted in to MySQl table. My code is as below : if($insert_query) {
-1
votes
1 answer

in C#, msgbox didn't show

Below is part of my codes in C#, it suppose to send email, show the msg box, then direct to 'Multihotelbook.aspx' page, but the direct to the page without showing the msgbox. i dont know why. need help emailClient.Send(message); //…
Melinda
  • 1
  • 2
-2
votes
1 answer

vbscript wont do "if" properly

I was creating a vbs but after i click Yes in msgbox, it instead does what the "No" is supposed to do. Here is my code: X=MsgBox("Please Restart. Our system will break down.",4+4096, ErR0r) if vbNo then X=MsgBox("e") dim count set object =…
-2
votes
1 answer

Excel VBA script to check whether cell value appears in array of other cells. If not, show a MsgBox and force the user to re-input

VBA beginner here. I apologize for not being able to provide a code snippet, but I'm seeking a script that works as follows: Check whether the value inputted in a cell (say A1) appears in an array of cells (say B1:B100). If the value inputted to…
-2
votes
1 answer

Question about writing code in VBScript to create a reminder or alarm

I wish to create a reminder or an alarm to remind myself of reports due especially with irregular frequency. Below is the code I wish to call automatically on a day and time I specify. It will pop up a message box and if No is clicked, it will ask…
Passer-by
  • 71
  • 2
  • 10
-2
votes
2 answers

VBA arrays/msg boxes etc

I need a msgbox to appear if nothing has expired, is expiring, and as long as there is data in 1, 2, and 19. Currently it displays it for anyone fitting the above, but it should only come up if every single row fits the above. It should then reject…
N Wally
  • 1
  • 1
  • 4
-2
votes
1 answer

The quantity of price in floating is not showing on msgbox as floating instead of showing integer

i have a project in vb 6.0. its simple project of a sales purchase. The quantity prices are in floating value but problem is that whenever i made a sales order the prices are in rounded. not in floating value. kindly suggest me what to do
Atiq shk
  • 1
  • 2
-2
votes
2 answers

VBA - msgbox 10 days before a birthday

In sheet1 in column B i have names In sheet 1 in column D i have birthday dates B: Ben Mikael D: 3 MARCH 1987 3 JUNE 1976 I want to find a VBA script to make a popup msgbox and print out "There is 10 days or less untill NAME(from column B) have a…
Behedwin
  • 27
  • 2
  • 8
-2
votes
1 answer

Create msgbox when running batch

@echo off wmic csproduct get uuid pause wmic DISKDRIVE get SerialNumber pause getmac pause I need each one to pop its own message box, so when I click OK it moves to the next one and then the next one. At the end it saves all as a text document on…
Arodger
  • 9
  • 2
-2
votes
1 answer

Multiple MsgBoxes

I keep receiving multiple MsgBoxes with the same error messages. How do I keep this from happening? Private Sub BtnCalc_Click(sender As Object, e As EventArgs) Handles BtnCalc.Click Dim intValue1 As Integer Dim intValue2 As Integer Dim…
Michiel13
  • 1
  • 1
-2
votes
2 answers

ElseIf Statement Not Reaching Msgbox Error

It will not run the msgbox for the errors when incorrect data is entered Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim weight As Decimal Dim height As Decimal …
-3
votes
1 answer

Showing MsgBox() with nowait (no user input) is not the real issue

I had searched a lot how to display a Msgbox that will not wait the user input (pressing ok or cancel). I found 3 solutiuons to this. 1- Display the MsgBox() in another thread or using BackgroundWorker() 2- Create a form that display the message,…
-6
votes
1 answer

I've Written The Code For The Button's Click Event, But Nothing Happens When I Click It At Run Time. Why?

I'm using VS2017 and vb.net to create a simple app that takes input as text from the user and when a button is clicked, it will display it in a MsgBox. However, when i write the code in the buton's click event, nothing happens. Please Help. Thanks…
Tejas
  • 1
  • 3
1 2 3
26
27