TablePattern.TablePatternInformation.ColumnCount 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得資料表的資料行總數。
public:
property int ColumnCount { int get(); };
public int ColumnCount { get; }
member this.ColumnCount : int
Public ReadOnly Property ColumnCount As Integer
屬性值
資料表的資料行總數。 預設值為零。
範例
在下列範例中, 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