Questions tagged [messagebox]

A message box is a prefabricated modal dialog box that displays a text message to a user.

1861 questions
401
votes
9 answers

Is there a MessageBox equivalent in WPF?

Is there a standard message box in WPF, like WinForms' System.Windows.Forms.MessageBox.Show(), or should I use the WinForms message box?
Makach
  • 7,435
  • 6
  • 28
  • 37
167
votes
23 answers

Show a popup/message box from a Windows batch file

Is there a way to display a message box from a batch file (similar to how xmessage can be used from bash-scripts in Linux)?
billyy
  • 2,265
  • 3
  • 18
  • 13
146
votes
9 answers

How to pop an alert message box using PHP?

How to pop an alert message box using PHP?
adil
  • 1,507
  • 2
  • 10
  • 4
99
votes
15 answers

Close a MessageBox after several seconds

I have a Windows Forms application VS2010 C# where I display a MessageBox for show a message. I have an okay button, but if they walk away, I want to timeout and close the message box after lets say 5 seconds, automatically close the message…
Kiquenet
  • 14,494
  • 35
  • 148
  • 243
84
votes
4 answers

How to add message box with 'OK' button?

I want to display a message box with an OK button. I used the following code but it results in a compile error with argument: AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); dlgAlert.setMessage("This is an alert with no…
Rajkumar Reddy
  • 2,357
  • 6
  • 24
  • 29
80
votes
4 answers

How to change the button text for 'Yes' and 'No' buttons in the MessageBox.Show dialog?

I need to change the message box control buttons Yes to Continue and No to Close. How do I change the button text? Here is my code: DialogResult dlgResult = MessageBox.Show("Patterns have been logged successfully", "Logtool",…
bala3569
  • 10,832
  • 28
  • 102
  • 146
72
votes
6 answers

center MessageBox in parent form

Is there a easy way to center MessageBox in parent form in .net 2.0
Ramji
  • 2,536
  • 7
  • 34
  • 54
64
votes
5 answers

C# MessageBox dialog result

I want to make a MessageBox confirmation. Here is the message box: MessageBox.Show("Do you want to save changes?", "Confirmation", messageBoxButtons.YesNoCancel); And I want to make something like this (in pseudocode): if (MessageBox.Result ==…
biox
  • 1,526
  • 5
  • 17
  • 28
58
votes
6 answers

Winforms-How can I make MessageBox appear centered on MainForm?

Winforms-How can I make dialog boxes appear centered on MainForm? That is as opposed to be based on Normal windows default which renders them in the centre of the screen. In my case I have a small main form that may for example be positioned in a…
Greg
  • 34,042
  • 79
  • 253
  • 454
58
votes
5 answers

Why isn't MessageBox TopMost?

I recently found out that by default MessageBoxes were not the top most form when displayed by default and I was wondering if anyone knew any circumstances when you wouldn't want the messagebox to be shown on top of other windows? I found the issue…
Sayse
  • 42,633
  • 14
  • 77
  • 146
51
votes
5 answers

WPF MessageBox window style

How to apply the default Windows style to the standard MessageBox in WPF? For example, when I execute next code: MessageBox.Show("Hello Stack Overflow!", "Test", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); I'm getting message…
kyrylomyr
  • 12,192
  • 8
  • 52
  • 79
51
votes
5 answers

How do i get an Image for the various MessageBoxImage(s) or MessageBoxIcon(s)

How do i get an System.Drawing.Image for the various System.Windows.MessageBoxImage(s) and/or System.Windows.Forms.MessageBoxIcon(s)
Simon
  • 33,714
  • 21
  • 133
  • 202
50
votes
10 answers

MessageBox with YesNoCancel - No & Cancel triggers same event

I have a message box with the YesNoCancel buttons... Pressing Yes will do some action and close the application - works fine Pressing No will do nothing and close the application - (see below) Pressing Cancel will do nothing and keep the…
Bibhas Debnath
  • 14,559
  • 17
  • 68
  • 96
48
votes
13 answers

How have you successfully implemented MessageBox.Show() functionality in MVVM?

I've got a WPF application which calls MessageBox.Show() way back in the ViewModel (to check if the user really wants to delete). This actually works, but goes against the grain of MVVM since the ViewModel should not explicitly determine what…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
41
votes
4 answers

Show message Box in .net console application

How to show a message box in a .net c# or vb console application ? Something like: Console.WriteLine("Hello World"); MessageBox.Show("Hello World"); or Console.WriteLine("Hello") MsgBox("Hello") in c# and vb respectively. Is it possible?
Syed Osama Maruf
  • 1,895
  • 2
  • 20
  • 37
1
2 3
99 100