|
-
Oct 20th, 2010, 06:12 AM
#2
Re: Need help in ListView
Hi jose... Welcome to the forums...
One way is to query the database for selecting records which have the brgy code lesser than the one being searched. Then, display the records in a ListView control.
Second way is to loop through all the items in the first listview(which will be filled with the entire data) and add the low valued brgy code items to the second listview control.
Example:
vb Code:
Option Explicit
Private Sub Command1_Click()
Dim i As Long
Dim lngSearch As Long
Dim lvwItem As ListItem
lngSearch = CLng(Text1.Text) '~~~ Number to be searched
For i = 1 To ListView1.ListItems.Count '~~~ Loop through each item in the first ListView
If CLng(ListView1.ListItems(i).Text) < lngSearch Then '~~~ Check if the item is lesser than the number to be searched
Set lvwItem = ListView2.ListItems.Add(, , ListView1.ListItems(i).Text) '~~~ If so, add the contents to the second listview
lvwItem.SubItems(1) = ListView1.ListItems(i).SubItems(1)
lvwItem.SubItems(2) = ListView1.ListItems(i).SubItems(2)
lvwItem.SubItems(3) = ListView1.ListItems(i).SubItems(3)
lvwItem.SubItems(4) = ListView1.ListItems(i).SubItems(4)
lvwItem.SubItems(5) = ListView1.ListItems(i).SubItems(5)
Set lvwItem = Nothing
End If
Next
End Sub
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
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
|