CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: How to highlight a record in a MSHFlexGrid?

  1. #1
    Join Date
    Jun 2012

    How to highlight a record in a MSHFlexGrid?

    I have a MSHFlexGird (fgdCompany) and a search command. When the user enters the search data into "txtSearch", the command should search for the data and show it to the user by :

    Highlighting the record in the MSHFlexGrid
    By bringing the row that contains the searched data to the top of the MSHFlexGrid.

    The code that I am using is given below. The search function works perfectly. Only thing is I can't make the record that contains the searched data be highlighted so that the user knows in which record the data that was search data is present. Can anybody could give me the code to highlight the record found in any of the two methods given above (preferably the first option).

        Dim xString As String, xRow As Integer, xNext As Integer
        xString = txtSearch.Text
        For xNext = 0 To fgdCompany.Rows
        fgdCompany.Row = xNext
        xRow = fgdCompany.Row
        If xString = fgdCompany.TextMatrix(xRow, 1) Then 'Assuming that the string to be searched is in coloumn 1...
        myRow = fgdCompany.Row
        Exit For
        End If
        Next xNext

  2. #2
    Join Date
    Jul 2005

    Re: How to highlight a record in a MSHFlexGrid?

    You could try BackColor and TopRow property

    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)