messagebox

WPF MessageBox window style

别等时光非礼了梦想. 提交于 2019-11-26 18:36:18
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 box: But in WinForms everything is OK with style: MessageBox.Show("Hello Stack Overflow!", "Test", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); Gimno According to this page, WPF picks up the old styles for some of the controls. To get rid of it, you have to create a custom app.manifest file (Add -> New item -> Application Manifest File) and paste

How to display an error message box in a web application asp.net c#

丶灬走出姿态 提交于 2019-11-26 18:29:57
问题 I have an ASP.NET web application, and I wanted to know how I could display an error message box when an exception is thrown. For example, try { do something } catch { messagebox.write("error"); //[This isn't the correct syntax, just what I want to achieve] } [The message box shows the error] Thank you 回答1: You can't reasonably display a message box either on the client's computer or the server. For the client's computer, you'll want to redirect to an error page with an appropriate error

How to create a custom MessageBox?

和自甴很熟 提交于 2019-11-26 17:48:25
I'm trying to make a custom message box with my controls. public static partial class Msg : Form { public static void show(string content, string description) { } } Actually I need to place some controls (a gridview) in this form and I have to apply my own theme for this window, so I don't want to use MessageBox . I want to call this from my other forms like Msg.show(parameters); I don't wish to create an object for this form. I know I can't inherit from Form class because it isn't static. But I wonder how MessageBox is implemented, because it is static. It is being called like MessageBox.show

MessageBox buttons - set language?

允我心安 提交于 2019-11-26 16:58:36
问题 When you use MessageBox.Show() you have a selection of MessageBoxButtons to choose from. The buttons available are an enum, and give you options like "Yes No", "OK Cancel", etc. When I am using, for instance, Norwegian message text the user still gets the English "Yes No". Is there a way to change the text of the buttons (in C#) so that the language is correct? Can I override the text, or set the current locale in some way so that I can have "Ja Nei" instead of "Yes No"? I do not want to rely

MessageBox.Show() Custom Icon?

被刻印的时光 ゝ 提交于 2019-11-26 16:08:56
问题 I want to use a custom icon in MessageBox.Show("Message", "Title", MessageBoxButton.OK, MeesageBoxIcon.myIcon) Method. Any suggestion please? 回答1: I wrote one a little while ago, it works exactly like the regular messagebox class. CustomMessageBox (Class): http://pastebin.com/m8evBmZi using System; using System.Drawing; using System.Windows.Forms; public static class CustomMessageBox { public static DialogResult Show(string Text, string Title, eDialogButtons Buttons, Image Image) {

Close a MessageBox after several seconds

人走茶凉 提交于 2019-11-26 14:16:21
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 box. There are custom MessageBox (that inherited from Form) or another reporter Forms, but it would be interesting not necessary a Form. Any suggestions or samples about it? Updated: For WPF Automatically close messagebox in C# Custom MessageBox (using Form inherit) http://www.codeproject.com/Articles/17253/A-Custom-Message-Box http://www.codeproject.com

Show a popup/message box from a Windows batch file

情到浓时终转凉″ 提交于 2019-11-26 14:02:23
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)? boflynn I would make a very simple VBScript file and call it using CScript to parse the command line parameters. Something like the following saved in MessageBox.vbs : Set objArgs = WScript.Arguments messageText = objArgs(0) MsgBox messageText Which you would call like: cscript MessageBox.vbs "This will be shown in a popup." MsgBox reference if you are interested in going this route. Joey First of all, DOS has nothing to do with it, you probably want a Windows command

Bold text in MessageBox

左心房为你撑大大i 提交于 2019-11-26 13:57:31
问题 How can I show the text in bold in the dialog displayed by MessageBox.Show , using C#? 回答1: It is possible, a message box is a regular window that can be messed with like any other. The code to do so is however a bit gritty. Add a new class to your project and paste this code: using System; using System.Text; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; class BoldMessageBox : IDisposable { private int mTries = 0; private Form mOwner; private Font

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

心已入冬 提交于 2019-11-26 12:11:33
问题 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 happens on the View. So now I am thinking how can I best implement the MessageBox.Show() functionality in my MVVM application, options: I could have a message with the text \"Are you sure...?\" along with two buttons Yes and No all in a Border in my

Is there a MessageBox equivalent in WPF?

余生长醉 提交于 2019-11-26 10:14:59
问题 Is there a standard message box in WPF, like WinForms\' System.Windows.Forms.MessageBox.Show(), or should I use the WinForms message box? 回答1: The WPF equivalent would be the System.Windows.MessageBox. It has a quite similar interface, but uses other enumerations for parameters and return value. 回答2: You can use this: MessageBoxResult result = MessageBox.Show("Do you want to close this window?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult