Skip to content

Commit

Permalink
XS✔ ◾ Update Sound-Message-Box (#7449)
Browse files Browse the repository at this point in the history
* Update rule.md

* Rename Folder

* Update Windows Forms Category

* Auto-fix Markdown files

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
tkapa and github-actions[bot] authored Dec 6, 2023
1 parent d1bb719 commit a009f93
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ index:
- title-bar-do-you-put-your-company-url-in-the-title-bar
- menu-do-you-use-icons-in-menu
- sound-do-you-realize-the-importance-of-sounds-to-user-interface
- sound-did-you-know-that-a-message-box-automatically-plays-a-beep
- sound-message-box
- long-process-do-you-know-how-to-make-long-running-processes-user-friendly
- long-process-do-you-show-the-status-of-progress-bar-on-winforms-title
- long-process-do-you-know-that-long-running-processes-should-allow-to-skip-the-processing-when-appropriate
Expand All @@ -30,4 +30,3 @@ index:
Since 1990, SSW has supported the developer community by publishing all our best practices and rules for everyone to see.

If you still need help, visit [Website Design and User Experience](http&#58;//www.ssw.com.au/ssw/Consulting/WebsiteDesignAndUserExperience.aspx) and book in a consultant.

Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ index:

---

Did you know that Windows Forms was recently updated with the release of .NET 8? See the changes on [Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/core/compatibility/windows-forms/8.0/anchor-layout)!
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
type: rule
title: Sound - Did you know that a message box automatically plays a beep?
uri: sound-did-you-know-that-a-message-box-automatically-plays-a-beep
uri: sound-message-box
authors:
- title: Adam Cogan
url: https://ssw.com.au/people/adam-cogan
related: []
redirects: []
redirects:
- sound-did-you-know-that-a-message-box-automatically-plays-a-beep
created: 2012-11-27T02:57:30.000Z
archivedreason: null
guid: 81d5da16-4a3d-420e-b92c-f73a0791b290
Expand All @@ -20,23 +21,25 @@ A message box automatically provides this functionality so there is no need to m
![Figure: Good example - Windows message boxes plays a sound... which cannot be captured in screenshot form.](../../assets/Win7SoundError.png)
:::

```vbnet
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
Beep()
result = MessageBox.Show( Me, Message, Caption, Buttons)
```csharp
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
System.Media.SystemSounds.Beep.Play();
DialogResult result = MessageBox.Show(this, message, caption, buttons);
```

::: bad
Figure: Bad example - The sound on the button is hardcoded in this code snippet
:::

```vbnet
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
result = MessageBox.Show( Me, Message, Caption, Buttons)
```csharp
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show(this, message, caption, buttons);
```

::: good
Figure: Good example - The code is not present in this example as it is automatically done
:::

0 comments on commit a009f93

Please sign in to comment.