Share via


ResponseSubmittedEventArgs Class

Provides data for the ResponseSubmitted event.

Namespace:  Microsoft.WindowsCE.Forms
Assembly:  Microsoft.WindowsCE.Forms (in Microsoft.WindowsCE.Forms.dll)

Syntax

'Declaration
Public Class ResponseSubmittedEventArgs _
    Inherits EventArgs
'Usage
Dim instance As ResponseSubmittedEventArgs
public class ResponseSubmittedEventArgs : EventArgs
public ref class ResponseSubmittedEventArgs : public EventArgs
public class ResponseSubmittedEventArgs extends EventArgs

Remarks

The ResponseSubmitted event occurs when the message balloon is dismissed by user input. You can use the Response property to ascertain values entered into an HTML form in the message balloon or to determine the name of a button or link clicked by the user.

Examples

The following code example parses the response string to determine which elements the user selected in a notification balloon. This code example is part of a larger example provided for the Notification class.

' When a ResponseSubmitted event occurs, this event handler 
' parses the response to determine values in the HTML form. 
Private Sub OnResponseSubmitted(obj As Object, _ 
   resevent As ResponseSubmittedEventArgs) Handles Notification1.ResponseSubmitted

   ' Use a StringBuilder to create a log of the response. 
   Dim LogResponse As New StringBuilder()


   ' If the response contains the name specified for the action value 
   ' of the HTML form, in this case "notify," get the value of the 
   ' selected option from the SELECT list. An example of the 
   ' response string would be notify?lstbx=0. 
   If resevent.Response.Substring(0, 6) = "notify" Then 
      Dim choice As Integer = Convert.ToInt32(resevent.Response.Substring(13, 1))
      Select Case choice
         Case 0
             LogResponse.Append("submit")
         Case 1
             LogResponse.Append("opt 1")
         Case 2
             LogResponse.Append("opt 2")
         Case 3
             LogResponse.Append("opt 3")
         Case 4
             LogResponse.Append("opt 4")
      End Select 
      ' If the checkbox in the form is checked, the response 
      ' string could be as follows: notify?lstbx=0chkbx=on 
      ' You can determine whether the check box is selected 
      ' by checking whether the response ends with "on". 
      If resevent.Response.EndsWith("on") Then
         LogResponse.Append("checkbox")
      End If 

   ' If the user clicked the settings link, 
   ' log the response. This example could display 
   ' a dialog box by activating another form. 
   ElseIf resevent.Response = "settings" Then 
      ' Display a settings dialog by activating 
      ' a form named 'Settings': 
      ' Settings.Activate
      LogResponse.Append("Postponed by clicking link")

      ' The user needs to respond to the notification 
      ' after checking the settings, so set the 
      ' InitialDuration and Visible properties so 
      ' that the icon appears in the title bar.
      Notification1.InitialDuration = 0
      Notification1.Visible = True 
   End If 

   ' Display the response on the status bar.
   StatusBar1.Text = LogResponse.ToString() + " HTML: " + resevent.Response.ToString()
End Sub
// When a ResponseSubmitted event occurs, this event handler 
// parses the response to determine values in the HTML form. 
private void OnResponseSubmitted(object obj, ResponseSubmittedEventArgs resevent)
{

    // Use a StringBuilder to create a log of the response.
    StringBuilder LogResponse = new StringBuilder();


    // If the response contains the name specified for the action value 
    // of the HTML form, in this case "notify," get the value of the
    // selected option from the SELECT list. An example of the 
    // response string would be notify?lstbx=0. 

    if (resevent.Response.Substring(0, 6) == "notify")
    {
        int choice = Convert.ToInt32(resevent.Response.Substring(13, 1));
        switch (choice)
        {
            case 0:
                LogResponse.Append("submit");
                break;
            case 1:
                LogResponse.Append("opt 1");
                break;
            case 2:
                LogResponse.Append("opt 2");
                break;
            case 3:
                LogResponse.Append("opt 3");
                break;
            case 4:
                LogResponse.Append("opt 4");
                break;
        }
        // If the checkbox in the form is checked, the response 
        // string could be as follows: notify?lstbx=0chkbx=on 
        // You can determine whether the check box is selected 
        // by checking whether the response ends with "on".
        if (resevent.Response.EndsWith("on"))
            LogResponse.Append("checkbox");
    }

    // If the user clicked the settings link, 
    // log the response. This example could display 
    // a dialog box by activating another form. 
    else if (resevent.Response == "settings")
    {
        // Display a settings dialog by activating 
        // a form named 'Settings': 
        // Settings.Activate
        LogResponse.Append("Postponed by clicking link");

        // The user needs to respond to the notification 
        // after checking the settings, so set the 
        // InitialDuration and Visible properties so 
        // that the icon appears in the title bar.
        notification1.InitialDuration = 0;
        notification1.Visible = true;
    }

    // Display the response on the status bar.
    statusBar1.Text = LogResponse.ToString() + " HTML: " + resevent.Response.ToString();
}

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.WindowsCE.Forms.ResponseSubmittedEventArgs

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also

Reference

ResponseSubmittedEventArgs Members

Microsoft.WindowsCE.Forms Namespace

Other Resources

How to: Send a Notification