Results 1 to 10 of 10

Thread: Need help to speed up my search <Resolved>

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    85

    Resolved Need help to speed up my search <Resolved>

    Hi

    can anyone guru out there help me speed up this search from a textbox to search at MSHFlexGrid. Cause this search is very slow when it comes to 10,000 records. And a search is done from every keypress.
    VB Code:
    1. Private Sub Textbox1_KeyUp(KeyCode As Integer, Shift As Integer)
    2. Call search(1, Textbox1, MSHFlexGrid1)
    3. End Sub
    4.  
    5. Public Sub search(ByVal pCol As Integer, ByRef pObject As TextBox, ByRef Grid As Object)
    6. Dim temp As Integer
    7. If Grid.Rows > 1 Then
    8.  
    9.     Grid.ColHeader(0) = flexColHeaderOff
    10.     Grid.Col = pCol
    11.     Grid.Sort = 5
    12.     Grid.ColHeader(0) = flexColHeaderOn
    13.  
    14.         For temp = 1 To Grid.Rows - 1
    15.             If LCase(pObject) = LCase(Left(Grid.TextMatrix(temp, Grid.Col), Len(pObject.Text))) Then
    16.                 Grid.highlight = flexHighlightAlways
    17.                 Grid.Row = temp
    18.                 Grid.SelectionMode = flexSelectionByRow
    19.                 Grid.Col = 0
    20.                 Grid.ColSel = Grid.Cols - 1
    21.                 Grid.TopRow = Grid.Row
    22.                 Exit For
    23.             Else
    24.                 Grid.highlight = flexHighlightWithFocus
    25.             End If
    26.  
    27.         Next
    28.  
    29. End If
    30. End Sub
    Last edited by Hack; Mar 24th, 2006 at 07:13 AM. Reason: Added green "resolved" checkmark

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