-
September 17th, 2013, 04:25 AM
#1
Search in InputBox VB6
Hi All,
I found the code
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
Beep
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?
-
September 17th, 2013, 09:33 AM
#2
Re: Search in InputBox VB6
Try converting to lower case both sides
Code:
If LCase(MSHFlexGrid1.TextMatrix(r, 7)) = LCase(target_name) Then
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
September 17th, 2013, 02:06 PM
#3
Re: Search in InputBox VB6
Hi
what was to help the conversion?
-
September 19th, 2013, 08:31 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|