Skip to main content
A newer version of this page is available. .

How to: Respond to Clicking on Alert Windows

  • 2 minutes to read

The following example shows how you can respond to an end-user clicking an alert window’s text. To respond to these actions, the AlertControl.AlertClick event is handled.

In the example, it’s assumed that alert windows are used to show notifications to end-users when a new e-mail arrives. When a new alert window is created, a custom MailData object is associated with the window. This object contains information on the e-mail received, and it is accessed and processed while handling the AlertControl.AlertClick event.

private void ShowAlertWindow() {
    Form owner;
    string caption, text, hotTrackedText;
    Image image;
    MailData mailData;
    // Initialize the owner, caption, text, hotTrackedText, image and mailData
    // ...
    // Show an alert window with these parameters
    alertControl1.Show(owner, caption, text, hotTrackedText, image, mailData);
}

private void alertControl1_AlertClick(object sender, AlertClickEventArgs e) {
    // Get and process the data associated with the current alert window.
    MailData mailData = e.Info.Tag as MailData;
    ShowEmail(mailData);
}

private void ShowEmail(MailData mailData) {
    //...
}

public class MailData {
    //...
}