1

我的表单允许用户搜索客户集合。当我单击“搜索”按钮时,我希望它仅显示找到的特定结果并隐藏其余客户。

例如,如果我输入客户 ID,133它应该只显示那个并隐藏其余的。

Private Sub SearchButton_Click(sender As Object, e As EventArgs) Handles SearchButton.Click
    Dim foundIndex As Integer
    Dim searchString As String
    searchString = SearchTextBox.Text
    foundIndex = CustomerRecBindingSource.Find("customerid", searchString)
    If foundIndex > -1 Then
        DataRepeater1.CurrentItemIndex = foundIndex
    Else
        MsgBox("Item " & searchString & " not found.")
    End If
End Sub

此版本仅将搜索结果置于顶部。它不会隐藏其余数据。

我尝试更改线路:

DataRepeater1.CurrentItemIndex = foundIndex

DataRepeater1.CurrentItem = foundIndex

但后来我得到了错误Property 'Current Item' is 'Read Only'

4

0 回答 0