Oct 14, 2014 06:02 AM
(This post was last modified: Oct 14, 2014 06:28 AM by ElementalTree.)
Hi, im working on a small project and I need some assistance with a listview. So i have listview1 where all items are displayed, and i have listview2 where the user inputs an item. The program refreshes and checks if any of the items in listview2 matches the top 3 items in listview1 it displays a message with some text and the matched items text, now i want this to check if a matched item is tagged and now show this in the message. How can i do this? I just need to check if its tagged, already have the tagging part, thanks 🤝
Or if I maybe use the checking option if thats better, using the item.tag
What do you mean with tagging? Selected?
Oct 14, 2014 11:19 AM
(This post was last modified: Oct 14, 2014 11:29 AM by ElementalTree.)
(Oct 14, 2014 10:23 AM)Adolf Hipster Wrote: What do you mean with tagging? Selected? Well i got the suggestion to use the items.tag method, but i dont know if thats the same as the item being checked. both works
It uses this code
Code Dim checkrows As Integer = 3
Dim numFound As Integer
Dim display As String = ""
For row As Integer = 0 To Math.Min(checkrows - 1, ListView1.Items.Count - 1)
Dim text As String = ListView1.Items(row).Text
For Each item2 As ListViewItem In ListView2.Items
If text.Contains(item2.Text) Then
numFound += 1
display &= text & vbCrLf
Exit For
End If
Next
Next
If numFound > 0 Then
NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info
NotifyIcon1.BalloonTipTitle = "New Releases:"
NotifyIcon1.BalloonTipText = display
NotifyIcon1.ShowBalloonTip(3)
End If
I want it so it checks if the item is checked and then ignores displaying that item
Has this to do anything with the anime project you made a previous thread about?
Also explain more, i dont understan what you mean with this.
Code I want it so it checks if the item is checked and then ignores displaying that item
Oct 14, 2014 11:41 AM
(This post was last modified: Oct 14, 2014 11:42 AM by ElementalTree.)
(Oct 14, 2014 11:38 AM)Adolf Hipster Wrote: Has this to do anything with the anime project you made a previous thread about?
Also explain more, i dont understan what you mean with this.
Code I want it so it checks if the item is checked and then ignores displaying that item
Uh yeah so you remember, then i can explain it a little better. I get the episodes into the listview right, and if the top 3 items matches any of the items in another listview it displays a message saying that this/these episodes have released. Now after this refreshes again and one of those items are still in the top 3 it keeps showing the message over and over until new episodes gets released and replaces the top 3 items. I want it to like check these items after showing the message once so it wont repeat.
(Oct 14, 2014 11:41 AM)ElementalTree Wrote: Uh yeah so you remember, then i can explain it a little better. I get the episodes into the listview right, and if the top 3 items matches any of the items in another listview it displays a message saying that this/these episodes have released. Now after this refreshes again and one of those items are still in the top 3 it keeps showing the message over and over until new episodes gets released and replaces the top 3 items. I want it to like check these items after showing the message once so it wont repeat.
My first thought would be placing the code in the SelectedItemChange for the listview, but not so sure if its going to work out.
Have you tried to google your problem?
(Oct 14, 2014 11:59 AM)Adolf Hipster Wrote: My first thought would be placing the code in the SelectedItemChange for the listview, but not so sure if its going to work out.
Have you tried to google your problem?
Yeah alot of times actually, didn't find one that fit my problem
(Oct 14, 2014 12:29 PM)ElementalTree Wrote: Yeah alot of times actually, didn't find one that fit my problem
Also instead of using .Contains when you check if the items exist in another listbox do it like this
Code For Each item In ListBox1.Items
For Each item2 In ListBox2.Items
If item2 = item Then
'one item has been found
'msgbox(item & "exists in listbox2")
End If
Next
Next
Wrote this from my phone but it should work.
Oct 15, 2014 03:59 AM
(This post was last modified: Oct 15, 2014 04:02 AM by ElementalTree.)
(Oct 14, 2014 12:59 PM)Adolf Hipster Wrote: Also instead of using .Contains when you check if the items exist in another listbox do it like this
Code For Each item In ListBox1.Items
For Each item2 In ListBox2.Items
If item2 = item Then
'one item has been found
'msgbox(item & "exists in listbox2")
End If
Next
Next
Wrote this from my phone but it should work.
Gonna test this out, so this is going to do the same as the other then? Why is this better to do?
Edit: just saw why this wont work, im just inputting the anime name and not Anime Episode <>
Well there is not much difference from my code than yours actually rather than yours checking if a string contains another string.
ie if checking if "dog" exists in "crack baby dog" it will return true (your code)
My code will check if a string is identical to another string.
I dont see any problem sticking with your current code for the checking though.
(Oct 15, 2014 04:04 AM)Adolf Hipster Wrote: Well there is not much difference from my code than yours actually rather than yours checking if a string contains another string.
ie if checking if "dog" exists in "crack baby dog" it will return true (your code)
My code will check if a string is identical to another string.
I dont see any problem sticking with your current code for the checking though.
Yeah thought so, but I want it to check if text contains text instead of item is item. But do you know how i could make the message system work like i want it to?
Oct 15, 2014 04:15 AM
(This post was last modified: Oct 15, 2014 04:27 AM by ElementalTree.)
how could this become a triple post all of a sudden what the hell
Oct 15, 2014 04:16 AM
(This post was last modified: Oct 15, 2014 10:12 AM by ElementalTree.)
oops double post because website didn't want to cooperate
(Oct 15, 2014 04:04 AM)Adolf Hipster Wrote: Well there is not much difference from my code than yours actually rather than yours checking if a string contains another string.
ie if checking if "dog" exists in "crack baby dog" it will return true (your code)
My code will check if a string is identical to another string.
I dont see any problem sticking with your current code for the checking though.
Already gave up on me Adolf? :( </3
(Oct 15, 2014 04:04 AM)Adolf Hipster Wrote: Well there is not much difference from my code than yours actually rather than yours checking if a string contains another string.
ie if checking if "dog" exists in "crack baby dog" it will return true (your code)
My code will check if a string is identical to another string.
I dont see any problem sticking with your current code for the checking though.
I want to check the item(s) that gets displayed in the message and at the next refresh check if the item(s) are checked or not and if true then exclude the item(s) from the message
|