【问题标题】:Make only one row show after search in FlexGrid VB6在 FlexGrid VB6 中搜索后只显示一行
【发布时间】:2020-01-22 07:38:52
【问题描述】:

所以我正在处理的 VB6 项目中有 FlexGrid。它在每一行都有名称,我有一个下拉菜单,因此用户可以选择他们想要查看更多信息的名称,这就是我所拥有的。

Dim target_name As String
Dim r As Integer

' Get the name.
target_name = Combo1
If Len(target_name) = 0 Then Exit Sub

' Search for the name, skipping the column heading row.
target_name = LCase$(target_name)
For r = 1 To MSFlexGrid1.Rows - 1
    If LCase$(MSFlexGrid1.TextMatrix(r, 0)) = _
        target_name Then
        ' We found the target. Select this row.
        MSFlexGrid1.Row = r
        MSFlexGrid1.RowSel = r
        MSFlexGrid1.Col = 0
        MSFlexGrid1.ColSel = MSFlexGrid1.Cols - 1

        ' Make the row visible.
        MSFlexGrid1.TopRow = r
        Exit Sub
    End If
Next r

效果很好,但它也显示了该名称下方的所有内容,我希望它仅突出所选名称。 任何帮助都会很棒。

【问题讨论】:

    标签: vb6 msflexgrid


    【解决方案1】:

    您的网格的数据源是什么?您可以将过滤器放在数据网格数据源上,这样当用户从下拉列表中选择名称时,只有选定的人员详细信息会从数据源返回到网格。 不完全是您要问的问题,而是我将如何实现您想要的结果。

    附:我在 VB6 中使用过 FlexGrid,但我不知道如何在网格上执行您所要求的操作(可能存在但我从未注意到它)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-18
      • 1970-01-01
      • 2018-10-11
      相关资源
      最近更新 更多