Share via


DataGrid.BackButtonClick 事件

在单击子表上的 Back 按钮时发生。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Event BackButtonClick As EventHandler
用法
Dim instance As DataGrid
Dim handler As EventHandler

AddHandler instance.BackButtonClick, handler
public event EventHandler BackButtonClick
public:
event EventHandler^ BackButtonClick {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
/** @event */
public void add_BackButtonClick (EventHandler value)

/** @event */
public void remove_BackButtonClick (EventHandler value)
JScript 支持使用事件,但不支持进行新的声明。

备注

在显示子表时,Back 按钮即可见。单击该按钮将使网格显示父表。

示例

下面的代码示例为 BackButtonClick 事件添加事件处理程序。

' Create an instance of the 'BackButtonClick' EventHandler.
Private Sub CallBackButtonClick()
   AddHandler myDataGrid.BackButtonClick, AddressOf Grid_BackClick
End Sub 'CallBackButtonClick


' Raise the event when 'BackButton' on child table is clicked.
 Private Sub Grid_BackClick(ByVal sender As Object, ByVal e As EventArgs)
     ' String variable used to show message.
     Dim myString As String = "BackButtonClick event raised, showing parent table"
     ' Show information about Back button.
     MessageBox.Show(myString, "Back button information")
 End Sub 'Grid_BackClick
// Create an instance of the 'BackButtonClick' EventHandler.
private void CallBackButtonClick()
{
   myDataGrid.BackButtonClick += new EventHandler(Grid_BackClick);
}

// Raise the event when 'BackButton' on child table is clicked.
private void Grid_BackClick(object sender, EventArgs e)
{
   // String variable used to show message.
   string myString = "BackButtonClick event raised, showing parent table";
   // Show information about Back button.
   MessageBox.Show(myString, "Back button information");
}
   // Create an instance of the 'BackButtonClick' EventHandler.
private:
   void CallBackButtonClick()
   {
      myDataGrid->BackButtonClick += gcnew EventHandler( this, &MyDataGrid::Grid_BackClick );
   }

   // Raise the event when 'BackButton' on child table is clicked.
   void Grid_BackClick( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      // String variable used to show message.
      String^ myString = "BackButtonClick event raised, showing parent table";

      // Show information about Back button.
      MessageBox::Show( myString, "Back button information" );
   }
// Create an instance of the 'BackButtonClick' EventHandler.
private void CallBackButtonClick()
{
    myDataGrid.add_BackButtonClick(new EventHandler(GridBackClick));
} //CallBackButtonClick

// Raise the event when 'BackButton' on child table is clicked.
protected void GridBackClick(Object sender, EventArgs e)
{
    // String variable used to show message.
    String myString = "BackButtonClick event raised, showing parent table";

    // Show information about Back button.
    MessageBox.Show(myString, "Back button information");
} //GridBackClick

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

DataGrid 类
DataGrid 成员
System.Windows.Forms 命名空间
DataGrid.AllowNavigation 属性