C Error Message Box
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have
Error Message Box In Peoplecode
Meta Discuss the workings and policies of this site About Us error message box vb Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with jquery error message box us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx like you, helping each other. Join them; it only takes a minute: Sign up How to show Error & Warning Message Box in .NET/ How to Customize MessageBox up vote 40 down vote favorite 8 Using C# .NET (Winforms). I want to know how can I show the message boxes with a Ding!! sound & a red http://stackoverflow.com/questions/2109441/how-to-show-error-warning-message-box-in-net-how-to-customize-messagebox colored cross mark in it. This is what I'm talking about: How to do such things for my software, with custom errors and custom warnings? MessageBox.Show("asdf"); doesn't give me customize. c# .net winforms share|improve this question edited Mar 13 at 11:32 Ilmari Karonen 31.2k544101 asked Jan 21 '10 at 13:21 claws 15k40100168 add a comment| 3 Answers 3 active oldest votes up vote 118 down vote accepted Try this: MessageBox.Show("Some text", "Some title", MessageBoxButtons.OK, MessageBoxIcon.Error); share|improve this answer edited Dec 31 '13 at 17:08 caiosm1005 8031023 answered Jan 21 '10 at 13:23 Andrew Hare 215k40497552 4 MSDN: Other icons you can use : msdn.microsoft.com/en-us/library/… –claws Jan 21 '10 at 14:00 add a comment| up vote 7 down vote Try details: use any option.. MessageBox.Show("your message", "window title", MessageBoxButtons.OK, MessageBoxIcon.Warning // for Warning //MessageBoxIcon.Error // for Error //MessageBoxIcon.Information // for Information //MessageBoxIcon.Question // for Question ); share|improve this answer answered Jun 30 '15 at 12:21 Ahosan Karim Asik 2,0131922 add a comment| up vote 1 down vo
the Win32 library provides a specific function that can be used to for this purpose. Message Box Creation To create a message box, use the MessageBox() function. Its syntax is: int MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType); The first argument, hWnd, can be a handle to the window from where the message box will be called. Otherwise, it can NULL. The second argument, lpText, is a null-terminated string, such as an array of characters. This is the actual message that will be presented to the user. As stated already, it can be one word, a whole sentence, a paragraph, even a hew paragraphs. The third argument, lpCaption, is the title that will display on the title bar. It also can be a null-terminated string, if you know what title you would like to display. Otherwise, it can be NULL, in which case the title bar would display Error. The simplest way you can create a message is by calling the MessageBox() function with all arguments set to NULL, in which case the message box would not make any sense: MessageBox(NULL, NULL, NULL, NULL); As stated already, the first argument is either a handle of the window that is calling it, or NULL. The simplest way to specify the second argument is by including a word or a sentence in double-quotes. Here is an example: MessageBox(NULL, L"I am just trying my wedding dress", NULL, NULL); If you want to display the message on various lines, you can separate sections with the new line character '\n'. Here is an example: MessageBox(NULL, L"It happened earlier\nDidn't it?", NULL, NULL); You can also use string editing techniques to create a more elaborate message. This means that you can use functions of the C string library to create your message. The caption of the message can be any word or sentence but convention wisdom would like this sentence to be in tune with the actual message. After all, unless the message is about bad news, Error as a title is not particularly cute. The fourth argument actually does three things. First it displays one or a few buttons. The buttons depend on the value specified fo