共用方式為


DataRepeater.DisplayedItemCount 屬性

取得數目DataRepeaterItem中可見的項目DataRepeater控制,選擇性地包括部分顯示的項目。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(False)> _
Public ReadOnly Property DisplayedItemCount ( _
    includePartialItems As Boolean _
) As Integer
[BrowsableAttribute(false)]
public int this[
    bool includePartialItems
] { get; }
[BrowsableAttribute(false)]
public:
property int DisplayedItemCount[bool includePartialItems] {
    int get (bool includePartialItems);
}
[<BrowsableAttribute(false)>]
member DisplayedItemCount : 
        includePartialItems:bool -> int with get
JScript 不支援索引屬性。

參數

  • includePartialItems
    類型:Boolean

    true要納入計數 ; 部分顯示的項目false包含僅完整顯示的項目。

屬性值

類型:Int32
顯示項目的計數。

備註

使用這個屬性來判斷多少DataRepeaterItem項目會顯示在DataRepeater控制項。

範例

下列範例示範如何傳回的顯示項目計數DataRepeater控制項。

Private Sub Button1_Click() Handles Button1.Click
    Dim msgString As String 
    Dim intFull As Integer 
    Dim intPartial As Integer 
    ' Get the count without including partially displayed items.
    intFull = DataRepeater1.DisplayedItemCount(False)
    ' Get the count, including partially displayed items.
    intPartial = DataRepeater1.DisplayedItemCount(True)
    ' Create the message string.
    msgString = CStr(intFull)
    msgString &= " items are fully visible and " 
    ' Subtract the full count from the partial count.
    msgString &= CStr(intPartial - intFull)
    msgString &= " items are partially visible."
    MsgBox(msgString)
End Sub
private void button1_Click(System.Object sender, System.EventArgs e)
{
    string msgString;
    int intFull;
    int intPartial;
    string stringFull;
    string stringPartial;
    // Get the count without including partially displayed items.
    intFull = dataRepeater1.get_DisplayedItemCount(false);
    // Get the count, including partially displayed items.
    intPartial = dataRepeater1.get_DisplayedItemCount(true);
    // Create the message string.
    stringFull = intFull.ToString();
    msgString = stringFull;
    msgString = msgString + " items are fully visible and ";
    // Subtract the full count from the partial count.
    intPartial = intPartial - intFull;
    stringPartial = intPartial.ToString();
    msgString = msgString + stringPartial;
    msgString = msgString + " items are partially visible.";
    MessageBox.Show(msgString);
}

.NET Framework 安全性

請參閱

參考

DataRepeater 類別

Microsoft.VisualBasic.PowerPacks 命名空間

FirstDisplayedItemIndex

其他資源

DataRepeater 控制項簡介 (Visual Studio)