DataGridCell.ToString 方法

定义

获取单元格的行号和列号。

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

返回

包含行号和列号的字符串。

示例

下面的示例使用 DataGridCell 对象的 方法返回控件的 ToStringCurrentCell 行号System.Windows.Forms.DataGrid

private:
   void Grid_MouseUp(
      Object^ sender, System::Windows::Forms::MouseEventArgs^ /*e*/ )
   {
      DataGrid^ dg = (DataGrid^)(sender);
      DataGridCell myCell = dg->CurrentCell;
      Console::WriteLine( myCell.ToString() );
   }
private void Grid_MouseUp
(object sender, System.Windows.Forms.MouseEventArgs e)
{
   DataGrid dg = (DataGrid)sender;
   DataGridCell myCell = dg.CurrentCell;
   Console.WriteLine(myCell.ToString());
}
Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
    Dim myGrid As DataGrid = CType(sender, DataGrid)
    Dim myCell As DataGridCell = myGrid.CurrentCell
    Console.WriteLine(myCell.ToString)
End Sub

适用于

另请参阅