|
-
Aug 11th, 2012, 12:51 AM
#1
Thread Starter
Junior Member
Searching ListView2 for string and removing
Trying to figure out how to find the text that is typed in "SeedKW text" and when Cmd button i clicked, it removes that text from "SeedKW text" from listview2
vb Code:
Dim srt As String = "Searches related to " & SeedKW.Text For Each srtItem As ListViewItem In ListView2.Items If srtItem.SubItems.Item(0).Text = srt Then MsgBox(srt) End If Next
I Would like to have it search for a partial string like and removing everything from listview one that contains "Searches related to" is that's possible.
-
Aug 11th, 2012, 03:46 AM
#2
Re: Searching ListView2 for string and removing
Strings have a StartsWith method that you could use to identify partial strings:-
vbnet Code:
'
Dim strn As String = "ABC 123"
If strn.StartsWith("ABC") Then MsgBox("YES!!!")
-
Aug 11th, 2012, 01:00 PM
#3
Thread Starter
Junior Member
Re: Searching ListView2 for string and removing
 Originally Posted by Niya
Strings have a StartsWith method that you could use to identify partial strings:-
vbnet Code:
'
Dim strn As String = "ABC 123"
If strn.StartsWith("ABC") Then MsgBox("YES!!!")
Thank you, this is what i came up with from your code.
VB.NET Code:
For Each srt As ListViewItem In ListView2.Items
If srt.SubItems(0).Text.StartsWith("Searches related to") Then
ListView2.Items.Remove(srt)
End If
Next
-
Aug 11th, 2012, 01:07 PM
#4
Thread Starter
Junior Member
Re: Searching ListView2 for string and removing
 Originally Posted by Niya
Strings have a StartsWith method that you could use to identify partial strings:-
vbnet Code:
'
Dim strn As String = "ABC 123"
If strn.StartsWith("ABC") Then MsgBox("YES!!!")
Thank you, this is what i came up with
VB.NET Code:
For Each srt As ListViewItem In ListView2.Items
If srt.SubItems(0).Text.StartsWith("Searches related to") Then
ListView2.Items.Remove(srt)
End If
Next
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
|