QuestionEventArgs Class

Provides data for events that need a true or false answer to a question.


Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

Public Class QuestionEventArgs _
	Inherits EventArgs

The QuestionEventArgs type exposes the following members.

Public methodQuestionEventArgsInitializes a new instance of the QuestionEventArgs class using a default Response property value of false.
Public methodQuestionEventArgs(Boolean)Initializes a new instance of the QuestionEventArgs class using the specified default value for the Response property.

Public propertyResponseGets or sets a value indicating the response to a question represented by the event.


This class is currently used with the CancelRowEdit and RowDirtyStateNeeded events of the DataGridView control. It allows you to specify a response to events that occur when the control needs the answer to a question. The answer to the question is specified by setting the Response property.

The following code example demonstrates the use of this type. In the example, an event handler reports on the occurrence of the CancelRowEdit event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.


Private Sub DataGridView1_CancelRowEdit(sender as Object, e as QuestionEventArgs) _ 
     Handles DataGridView1.CancelRowEdit

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Response", e.Response)
    MessageBox.Show(messageBoxVB.ToString(),"CancelRowEdit Event")

End Sub

.NET Framework


.NET Framework Client Profile

Supported in: 4, 3.5 SP1



Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft