Results 1 to 4 of 4

Thread: Flexgrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    United Kingdom
    Posts
    1

    Post

    I have a search facility on a flexgrid. When the search results are returned, the coding I have shows the search text highlighted within the flexgrid. However, the rows that do not contain the search text are also shown. How can I show only those rows which contain the search text?

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    I don't believe that the flexgrid has a FILTER property.....I suppose you could follow this pseudocode:

    DO UNTIL (LAST ROW IN GRID)
    IF CONDITION = FALSE THEN (REMOVE ROW)
    LOOP

    Just my 2 cents

  3. #3
    Member
    Join Date
    Nov 1999
    Posts
    63

    Post

    You can set your flexgrid's datasource property to an ADO recordset. Then all you need to do is change the recordset's filter property and your flexgrid will automatically show the results. For an example, add a hierarchical flexgrid and a couple of command buttons to a form and try the following code.

    Code:
    Dim cn As New ADODB.Connection
    Dim rs As ADODB.Recordset
    
    Private Sub Command1_Click()
        rs.Filter = "companyname LIKE 'g%'"
    End Sub
    
    Private Sub Command2_Click()
        rs.Filter = adFilterNone
    End Sub
    
    Private Sub Form_Load()
        cn.ConnectionString = _
        "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=northwind.mdb"
        cn.CursorLocation = adUseClient
        cn.Open
        
        Set rs = cn.Execute("SELECT * FROM customers")
        Set MSHFlexGrid1.DataSource = rs
    
    End Sub

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Good thinkin' Gerald, I forgot you can bind to the flexgrid....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width