tags:

views:

159

answers:

1

So i have flexgrid in my vb6 project I'm working on. It has names on each row, and I have a drop down so the user can select what name they want to see more info for, here is what I have.

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

That works well, but it shows everything below that name too, I would like it to single out only the name selected. Any help would be great.

A: 

Whats the data source of your grid? You can place the filter on the data grid data source, so that as the user chooses the name from your drop down only the selected persons details are returned from the datasource to the grid. Not exactly what you were asking, but its how I would acheive the result you are wanting.

P.S. I have used flexgrid in vb6 and I dont know of a way to do what you are asking on the grid (might be there but I never used or noticed it).

miltonb