From: Amrit on 3 Dec 2009 02:58 HI All Is there any way to find subitem in ListView with out using loop Tahkns Amrit
From: Nobody on 3 Dec 2009 03:30 "Amrit" <cadd(a)wlink.com.np> wrote in message news:un0Vf5%23cKHA.5796(a)TK2MSFTNGP06.phx.gbl... > HI All > > Is there any way to find subitem in ListView with out using loop If you used "Key" parameter when adding items, you could use it to find items quickly, but it's not easy to make it work for multiple columns. Example: ListView1.ListItems("Item123"). Collections in VB use an efficient method of searching by using hash tables, so finding items this way is fast, adding them is slow because the Collection does some indexing to make retrieval faster. Another option is using a virtual ListView. In this case, the items are not stored in the ListView, and it only show one screen-full at a time. This makes it super fast. You can store your data in an array of UDT, and if you want to find an item, just search your array. For a VB6 sample, search this page for "Virtual ListView Demo.zip (19KB)". http://www.mvps.org/vbvision/Sample_Projects.htm#CustomDrawLV_Demo There is a different sample with similar name, "Virtual Listbox Demo.zip (34KB)". This is not the same sample.
From: Dave O. on 3 Dec 2009 06:25 "Amrit" <cadd(a)wlink.com.np> wrote in message news:un0Vf5%23cKHA.5796(a)TK2MSFTNGP06.phx.gbl... > HI All > > Is there any way to find subitem in ListView with out using loop > > Tahkns > Amrit Have a look at the messages: LVM_FINDITEMA & LVM_FINDITEMW http://msdn.microsoft.com/en-us/library/bb774903(VS.85).aspx It's not one I've used myself but it does not look too tricky, first fill a LVFINDINFO (http://msdn.microsoft.com/en-us/library/bb774745(VS.85).aspx) structure, then send the message with SendMessage. It should either return the index of the containing listitem or -1 if no match is found. BTW it's really quite easy to find these, I keep a copy of COMMCTRL.H and I just glance through the values starting with LVM_ (List View Message) until I find one that sounds like it might do what's needed, then use Google to find the documentation at MSDN and read that then either have a go or return to Google to hunt down some examples. The same principle obviously applies to all intrinsic controls although you'll need the correct header file for other controls (WINUSER.H has a lot). You'll notice that many messages that deal with strings have "A" and "W" versions, basically the W (wide) one is for unicode. Regards Dave O.
From: Amrit on 3 Dec 2009 11:28 Hi Dave Thanks you both for Respond. Well, I don't know much about winapi. is that possible to tell me where can i get example for LVM_FINDITEMA & LVM_FINDITEMW for VB. and how to apply it. I search in Google. But result is not good for me. I really appreciate your input. Thanks. Thanks for help. Amrit "Dave O." <nobody(a)nowhere.com> wrote in message news:ezTdLtAdKHA.4880(a)TK2MSFTNGP05.phx.gbl... > > "Amrit" <cadd(a)wlink.com.np> wrote in message > news:un0Vf5%23cKHA.5796(a)TK2MSFTNGP06.phx.gbl... >> HI All >> >> Is there any way to find subitem in ListView with out using loop >> >> Tahkns >> Amrit > > Have a look at the messages: LVM_FINDITEMA & LVM_FINDITEMW > http://msdn.microsoft.com/en-us/library/bb774903(VS.85).aspx > > It's not one I've used myself but it does not look too tricky, first fill > a LVFINDINFO > (http://msdn.microsoft.com/en-us/library/bb774745(VS.85).aspx) structure, > then send the message with SendMessage. It should either return the index > of the containing listitem or -1 if no match is found. > > BTW it's really quite easy to find these, I keep a copy of COMMCTRL.H and > I just glance through the values starting with LVM_ (List View Message) > until I find one that sounds like it might do what's needed, then use > Google to find the documentation at MSDN and read that then either have a > go or return to Google to hunt down some examples. The same principle > obviously applies to all intrinsic controls although you'll need the > correct header file for other controls (WINUSER.H has a lot). > > You'll notice that many messages that deal with strings have "A" and "W" > versions, basically the W (wide) one is for unicode. > > Regards > Dave O. > >
From: Dave O. on 3 Dec 2009 11:44 Well I used Google with this: LVM_FINDITEM VB -net and got loads of hits, granted most were junk but this one: http://forums.devx.com/archive/index.php/t-153973.html had something useful about half way down the page Incidentally, have you tried the ListView built in FindItem command? If you don't want to read a ListView in a different application then the native command should be adequate. Regards Dave O. "Amrit" <cadd(a)wlink.com.np> wrote in message news:%23RxxsWDdKHA.2188(a)TK2MSFTNGP04.phx.gbl... > Hi Dave > > Thanks you both for Respond. > > > > Well, I don't know much about winapi. is that possible to tell me where > can i get example for LVM_FINDITEMA & LVM_FINDITEMW > > > for VB. and how to apply it. > > I search in Google. But result is not good for me. > > I really appreciate your input. Thanks. > > Thanks for help. > > Amrit > > > > "Dave O." <nobody(a)nowhere.com> wrote in message > news:ezTdLtAdKHA.4880(a)TK2MSFTNGP05.phx.gbl... >> >> "Amrit" <cadd(a)wlink.com.np> wrote in message >> news:un0Vf5%23cKHA.5796(a)TK2MSFTNGP06.phx.gbl... >>> HI All >>> >>> Is there any way to find subitem in ListView with out using loop >>> >>> Tahkns >>> Amrit >> >> Have a look at the messages: LVM_FINDITEMA & LVM_FINDITEMW >> http://msdn.microsoft.com/en-us/library/bb774903(VS.85).aspx >> >> It's not one I've used myself but it does not look too tricky, first fill >> a LVFINDINFO >> (http://msdn.microsoft.com/en-us/library/bb774745(VS.85).aspx) structure, >> then send the message with SendMessage. It should either return the index >> of the containing listitem or -1 if no match is found. >> >> BTW it's really quite easy to find these, I keep a copy of COMMCTRL.H and >> I just glance through the values starting with LVM_ (List View Message) >> until I find one that sounds like it might do what's needed, then use >> Google to find the documentation at MSDN and read that then either have a >> go or return to Google to hunt down some examples. The same principle >> obviously applies to all intrinsic controls although you'll need the >> correct header file for other controls (WINUSER.H has a lot). >> >> You'll notice that many messages that deal with strings have "A" and "W" >> versions, basically the W (wide) one is for unicode. >> >> Regards >> Dave O. >> >> > >
|
Next
|
Last
Pages: 1 2 Prev: upgrading common controls v5 to v6 Next: Need WritePrivateProfileString replacement |