CA1300: Specify MessageBoxOptions
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CA1300: Specify MessageBoxOptions.
TypeName|SpecifyMessageBoxOptions|
|CheckId|CA1300|
|Category|Microsoft.Globalization|
|Breaking Change|Non-breaking|
A method calls an overload of the MessageBox.Show method that does not take a System.Windows.Forms.MessageBoxOptions argument.
To display a message box correctly for cultures that use a right-to-left reading order, the RightAlign and RtlReading members of the MessageBoxOptions enumeration must be passed to the Show method. Examine the Control.RightToLeft property of the containing control to determine whether to use a right-to-left reading order.
To fix a violation of this rule, call an overload of the Show method that takes a MessageBoxOptions argument.
It is safe to suppress a warning from this rule when the code library will not be localized for a culture that uses a right-to-left reading order.
The following example shows a method that displays a message box that has options that are appropriate for the reading order of the culture. A resource file, which is not shown, is required to build the example. Follow the comments in the example to build the example without a resource file and to test the right-to-left feature.