Edit

Share via


CommandEventArgs Constructors

Definition

Initializes a new instance of the CommandEventArgs class.

Overloads

CommandEventArgs(CommandEventArgs)

Initializes a new instance of the CommandEventArgs class with another CommandEventArgs object.

CommandEventArgs(String, Object)

Initializes a new instance of the CommandEventArgs class with the specified command name and argument.

CommandEventArgs(CommandEventArgs)

Initializes a new instance of the CommandEventArgs class with another CommandEventArgs object.

public:
 CommandEventArgs(System::Web::UI::WebControls::CommandEventArgs ^ e);
public CommandEventArgs (System.Web.UI.WebControls.CommandEventArgs e);
new System.Web.UI.WebControls.CommandEventArgs : System.Web.UI.WebControls.CommandEventArgs -> System.Web.UI.WebControls.CommandEventArgs
Public Sub New (e As CommandEventArgs)

Parameters

e
CommandEventArgs

A CommandEventArgs that contains the event data.

Examples

The following example demonstrates how to create and initialize a new instance of the CommandEventArgs class using the specified CommandEventArgs object.

void Command_Button_Click(Object sender, CommandEventArgs e)
{
    CommandEventArgs args = new CommandEventArgs(e);
}
Private Sub Command_Button_Click(sender As Object, e As CommandEventArgs)
    Dim args As New CommandEventArgs(e)
End Sub

Remarks

Use this constructor to create and initialize a new instance of the CommandEventArgs class using the specified CommandEventArgs object.

When an instance of CommandEventArgs is created by a call to this constructor, the following properties are initialized to the specified values.

Property Initial Value
CommandName The e.CommandName parameter.
CommandArgument The e.CommandArgument parameter.

See also

Applies to

CommandEventArgs(String, Object)

Initializes a new instance of the CommandEventArgs class with the specified command name and argument.

public:
 CommandEventArgs(System::String ^ commandName, System::Object ^ argument);
public CommandEventArgs (string commandName, object argument);
new System.Web.UI.WebControls.CommandEventArgs : string * obj -> System.Web.UI.WebControls.CommandEventArgs
Public Sub New (commandName As String, argument As Object)

Parameters

commandName
String

The name of the command.

argument
Object

A Object that contains the arguments for the command.

Examples

The following example demonstrates how to create and initialize a new instance of the CommandEventArgs class using the specified command name and argument.

private void Command_Button_Click(Object sender, CommandEventArgs e)
{
    CommandEventArgs args2 = new CommandEventArgs("Sort", "Descending");
}
Private Sub Command_Button_Click(sender As Object, e As CommandEventArgs)
    Dim args2 As New CommandEventArgs("Sort", "Descending")
End Sub

Remarks

Use this constructor to create and initialize a new instance of the CommandEventArgs class using the specified command name and argument.

When an instance of CommandEventArgs is created by a call to this constructor, the following properties are initialized to the specified values.

Property Initial Value
CommandName The value of the commandName parameter.
CommandArgument The value of the argument parameter.

See also

Applies to