CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 1999
    Posts
    9

    How to send messages to Grid Control

    Hi,
    I want to send messages to MSFlexGrid using SendMessage API. What is the Constant do i need to use in wParam Parameter. Any help is much appreciated. Tx in advance
    Giri


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: How to send messages to Grid Control

    the values for wParam and lParam are message specific, i.e. depending on the message you want to send, you'll have to spend different parameters.
    So tell us what message you want to send.


  3. #3
    Join Date
    Jun 1999
    Posts
    9

    Re: How to send messages to Grid Control

    I want to find particular value say a string "abc" in the cell 1,1(Is there any msg like LB_FINDSTRING!)


  4. #4
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: How to send messages to Grid Control

    Rather than relying on a message/api solution and I couldn't find anything on messages for the FlexGrid in the VC++ headers), couldn't you just use a routine similar to the one below ? :


    private Function FindInGrid(byval sText as string, _
    optional lColumn as Long = -99)
    '
    Dim lRowCount as Long
    Dim lRows as Long
    Dim lColCount as Long
    Dim lStartRow as Long
    '
    If lColumn < 0 then
    lColumn = 0
    End If
    '
    With MSFlexGrid1
    .Redraw = false
    lRows = .Rows - 1
    lStartRow = .FixedRows
    '
    for lRowCount = lStartRow to lRows
    '
    If InStr(1, .TextMatrix(lRowCount, _
    lColumn), sText, vbTextCompare) then
    '
    FindInGrid = lRowCount
    .Redraw = true
    Exit Function
    End If
    '
    next
    .Redraw = false
    End With
    '
    FindInGrid = -1 ' not found
    '
    End Function




    This routine will return the row number of the row where the text was found for the specified column.

    I ran this code on 1000 rows in a flexgrid and it found a match in under 0.5 seconds.



    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured