How to configure custom buttons in WinForms MessageBoxAdv?
Configure custom buttons
MessageBoxAdv has support for a set of built-in button combinations, and it also has support to configure your own set of custom button combinations based on application requirements. For example, here, we are configuring the button combination: Okay, Cancel, and Help.
C#
// Defining custom buttons string[] CustomButtons = new string[] { "Okay", "Cancel", "Help" }; // To retrieve clicked button index int clickedIndex = MessageBoxAdv.Show(this, "Custom Buttons", "Custom Button combination", CustomButtons) - 1; // Displaying clicked button information if (clickedIndex < CustomButtons.Length) { MessageBox.Show("Selected : " + CustomButtons[clickedIndex].ToString()); }
VB
' Defining custom buttons Dim CustomButtons() As String = { "Okay", "Cancel", "Help" } ' To retrieve clicked button index Dim clickedIndex As Integer = MessageBoxAdv.Show(Me, "Custom Buttons", "Custom Button combination", CustomButtons) - 1 ' Displaying clicked button information If clickedIndex < CustomButtons.Length Then MessageBox.Show("Selected : " & CustomButtons(clickedIndex).ToString()) End If
Sample: Example
Reference link: https://help.syncfusion.com/windowsforms/messagebox/button-parameters#buttons
Conclusion
I hope you enjoyed learning how to configure custom buttons in WinForms MessageBoxAdv.
You can refer to WinForms MessageBox feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms MessageBox example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!