RadControls for WinForms

The following tutorial will show you a simple usage of RadMessageBox

 

  1. Create a new Windows Application in Visual Studio
  2. Drag and drop a RadButton on the form.
  3. Subscribe to the Click event of this RadButton.
  4. Make sure that you import/use the following namespaces
    Copy[C#] Adding namespace
    using Telerik.WinControls;
    Copy[VB.NET] Adding namespace
    Imports Telerik.WinControls
  5. In the RadButton.Click event handler, first set the theme of the RadMessageBox and then call its static Show method of the RadMessageBox class, passing the appropriate parameters. Set the RadMessageBox.Show method to a DialogResult variable:
    Copy[C#] Setting a theme and showing RadMessageBox
    private void radButton1_Click(object sender, EventArgs e)
    {
        RadMessageBox.SetThemeName("Desert");
    
        DialogResult ds = RadMessageBox.Show(this, "Are you sure?", "Title", MessageBoxButtons.YesNo, RadMessageIcon.Question);
        this.Text = ds.ToString();
    }
    Copy[VB.NET] Setting a theme and showing RadMessageBox
    Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click
        RadMessageBox.SetThemeName("Desert")
    
        Dim ds As DialogResult = RadMessageBox.Show(Me, "Are you sure?", "Title", MessageBoxButtons.YesNo, RadMessageIcon.Question)
        Me.Text = ds.ToString()
    End Sub
  6. The result RadMessageBox is shown below: