CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2013

    Search in InputBox VB6

    Hi All,

    I found the code
    Private Sub Command1_Click()
    Dim target_name As String
    Dim r As Integer
        target_name = InputBox("PODAJ NAZWĘ", "NAZWA", "")
        If Len(target_name) = 1 Then Exit Sub
        target_name = LCase$(target_name)
        For r = 1 To MSHFlexGrid1.Rows - 1
            If LCase$(MSHFlexGrid1.TextMatrix(r, 7)) = target_name Then
                MSHFlexGrid1.Row = r
                MSHFlexGrid1.RowSel = r
                MSHFlexGrid1.Col = 0
                MSHFlexGrid1.ColSel = MSHFlexGrid1.Cols - 1
                MSHFlexGrid1.TopRow = r
                Exit Sub
            End If
        Next r
        End Sub
    The code works fine, but the condition introduced in InputBox shows me the first line in MSHFLEXGRID selected search words and I want to see all. Exit Sub I removed, but showed last line, which satisfies the condition. Can you help me?

  2. #2
    Join Date
    Jul 2005

    Re: Search in InputBox VB6

    Try converting to lower case both sides
    If LCase(MSHFlexGrid1.TextMatrix(r, 7)) = LCase(target_name) Then

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

  3. #3
    Join Date
    Sep 2013

    Re: Search in InputBox VB6

    what was to help the conversion?

  4. #4
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: Search in InputBox VB6

    Your code is only trying to select the first match

    Honestly I am not sure how to multiselect items in the flex grid via code but I would imagine you would have to add to the selection.

    Clearly your code is exiting when it finds a match thanks to the exit sub you have in there
    Without that it would look through the rest of the grid but would likely show the last match only then as you are setting the selection to the row which matches

    I would suggest a search for flex grid multi select via code and of course remove the exit sub to allow it to keep looking after it finds a match
    Always use [code][/code] tags when posting code.

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)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.