共用方式為


TablePattern.TablePatternInformation.RowCount 屬性

定義

取得資料表的資料列總數。

public:
 property int RowCount { int get(); };
public int RowCount { get; }
member this.RowCount : int
Public ReadOnly Property RowCount As Integer

屬性值

Int32

資料表的資料列總數。 預設值為零。

範例

在下列範例中, TablePattern 從目標控制項取得的物件會傳遞至擷取目前 TablePattern 屬性值的函式。

///--------------------------------------------------------------------
/// <summary>
/// Gets the current property values from target.
/// </summary>
/// <param name="tablePattern">
/// A TablePattern control pattern obtained from 
/// an automation element representing a target control.
/// </param>
///--------------------------------------------------------------------
private void GetRowColumnCounts(TablePattern tablePattern)
{
    if (tablePattern == null)
    {
        throw new ArgumentException("Target element cannot be null.");
    }

    Console.WriteLine(tablePattern.Current.RowCount.ToString());
    Console.WriteLine(tablePattern.Current.ColumnCount.ToString());
}
'''--------------------------------------------------------------------
''' <summary>
''' Gets the current property values from target.
''' </summary>
''' <param name="tablePattern">
''' A TablePattern control pattern obtained from 
''' an automation element representing a target control.
''' </param>
'''--------------------------------------------------------------------
Private Sub GetRowColumnCounts(ByVal tablePattern As TablePattern)
    If tablePattern Is Nothing Then
        Throw New ArgumentException("Target element cannot be null.")
    End If

    Console.WriteLine(tablePattern.Current.RowCount.ToString())
    Console.WriteLine(tablePattern.Current.ColumnCount.ToString())

End Sub

適用於

另請參閱