Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

Search Issue

$
0
0
hello =) again i need your help. my other thread are still waiting for replies,
hope this thread will be able to fix the another issue.

this is just another like Inventory system. the main purpose why i create a program
like this is for the printing of employees id cards and list their id numbers together
with the name of the id holder. it has it has 5 forms, 3 forms are the main namely;
Main, Add and Edit. the Main form is just a simple Listview and a Searchbox.

Issue: i want a search-box that auto click the searched data. so that
i dont need to waste 2 seconds to click the searched data anymore. auto click searched
will save the 2 seconds of my time.

the current code for the searchbox is just simply search and i clicked the searched
data just to edit or remove it.

Issue Code:
  1. Private Sub cmdRefresh_Click()
  2. Call RefreshListview
  3. lblSearch = Listview.ListItems.Count
  4. End Sub
  5. Private Sub Form_Load()
  6. Me.Top = (Screen.Height - Me.Height) / 2
  7. Me.Left = (Screen.Width - Me.Width) / 2
  8. Listview.LabelEdit = lvwManual
  9. Listview.FullRowSelect = True
  10. Listview.GridLines = True
  11. Listview.View = lvwReport
  12. cboCategory.Clear
  13. cboCategory.AddItem "All"
  14. cboCategory.ListIndex = 0
  15. Call RefreshListview
  16. lblSearch = Listview.ListItems.Count
  17. End Sub
  18. Private Sub refreshDataSearch()
  19. Dim Itmx As ListItem
  20. EmployeeMain.Listview.ListItems.Clear
  21. While Not FindRs.EOF = True
  22. Set Itmx = EmployeeMain.Listview.ListItems.Add(, , FindRs.Fields("Owner"))
  23. Itmx.SubItems(1) = FindRs.Fields("IDNumber")
  24. Itmx.SubItems(2) = FindRs.Fields("Status")
  25. Itmx.SubItems(3) = FindRs.Fields("Department")
  26. Itmx.SubItems(4) = FindRs.Fields("Acquired")
  27. Itmx.SubItems(5) = FindRs.Fields("Released")
  28. FindRs.MoveNext
  29. Wend
  30. End Sub
  31. Private Sub txtSearch_KeyPress(KeyAscii As Integer)
  32. KeyAscii = Asc(UCase(Chr(KeyAscii)))
  33. Call cmdSearch_Click
  34. End Sub
  35. Private Sub cmdSearch_Click()
  36. If cboCategory.ListIndex = 0 Then
  37. FindRecordset "Select * From Finder Where Owner like '%" & txtSearch.Text & "%' or IDNumber like '%" & txtSearch.Text & "%' or Acquired like '%" & txtSearch.Text & "%';"
  38. Call refreshDataSearch
  39. lblSearch = Listview.ListItems.Count
  40. End If
  41. Exit Sub:
  42. Set FindCon = Nothing
  43. Set FindRs = Nothing
  44. End
  45. End Sub
  46. Private Sub Listview_Click()
  47. On Error GoTo errorlistview
  48. lblMonitor = Listview.SelectedItem.Text
  49. Exit Sub:
  50. errorlistview:
  51. MsgBox "No I.D. to select!", vbExclamation, "Status"
  52. End Sub

thank you soo much =)

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>