Hello, I need help with a listbox, button, textbox.
What I want is this.
This is just an example i have.
I'm new in programming.
Example: I have entered in the search field textbox any words to search and click the button search it should find correct words which i have in my listbox list.Code:if listbox1.items.contains(textbox1.text) then add it to listbox else 'do not add it to lisbox end if 'loop faster.
If it didn't find after i have entered in textbox any words in they do not must correct words in listbox then do not add them in listbox remove them.
If items in listbox contains and match correct then add them to listbox otherwise,do not add them.
In this case, remove it.
How to do it ?
Thank you.
Can you suggest someone something ?
Thank you
- - - Updated - - -
I want to filter out bad words from one listbox and copy the good words to another one but from string cuz i scrape links from google search results ?
I have button search,textbox and listbox.
Maybe this will help you to understand what i mean.
This is what i have done so far.
u.cubeupload.com/polas6/cashlinks.png
Thank you.
String.Replace("ReplaceThisWith","This")
This is google scraper not one word i need to replace i need that it scrape urls from google search engine i know how to do that.
But i need this not one word to replace.
When i scrape urls from google it add about 300 urls in listbox1 and what i want so to find correct good urls from listbox1 and add them to listbox2 but not all urls from listbox1 only good and correct matching from string i type in textbox.
How to do that ?
I hope you will understand better what is what
Thank you.
Dim Scraped as String = Scraped URL
Dim UrlRequest As System.Net.WebRequest
Dim UrlResponse As System.Net.WebResponse
UrlRequest = System.Net.WebRequest.Create(Scraped)
Try
UrlResponse = UrlRequest.GetResponse()
Listbox2.additem(Scraped)
Catch e As WebException
'invalid url
End Try
Ok i will try and give the answer if it works
@polas1 what about learning how to use lists?
I think you want this
Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For Each item In ListBox1.Items If item.ToString.Contains(TextBox1.Text) Then ListBox2.Items.Add(item) End If Next End Sub
Ok guys i have tried but none of them working at all ;(
To understand better what i want.
here is how.
I want to remove bad word from listbox1 and put it into listbox2 only good list bad list if it does not find the good words do not add them to listbox2
- - - Updated - - -
yasiny yours will be great if it works but not working.
Can you suggest similar ?
Thank you.
Last edited by polas1; 08-24-2015 at 10:45 AM.
Last edited by Dab1996426; 08-24-2015 at 12:11 PM.
-[Nero..x3 (08-24-2015)
You say different things in every post -_-
Do you mean:
'After searching, if found a result of listbox1.items contains textbox1.text then add it to listbox2?'
Or
'If ListBox1 contains an item contains a "bad" word like "fck" "sh1t" "idiot" clean it first from these words and then add the item?'