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:
Private Sub Textbox1_KeyUp(KeyCode As Integer, Shift As Integer) Call search(1, Textbox1, MSHFlexGrid1) End Sub Public Sub search(ByVal pCol As Integer, ByRef pObject As TextBox, ByRef Grid As Object) Dim temp As Integer If Grid.Rows > 1 Then Grid.ColHeader(0) = flexColHeaderOff Grid.Col = pCol Grid.Sort = 5 Grid.ColHeader(0) = flexColHeaderOn For temp = 1 To Grid.Rows - 1 If LCase(pObject) = LCase(Left(Grid.TextMatrix(temp, Grid.Col), Len(pObject.Text))) Then Grid.highlight = flexHighlightAlways Grid.Row = temp Grid.SelectionMode = flexSelectionByRow Grid.Col = 0 Grid.ColSel = Grid.Cols - 1 Grid.TopRow = Grid.Row Exit For Else Grid.highlight = flexHighlightWithFocus End If Next End If End Sub




Reply With Quote