Results 1 to 12 of 12
  1. #1
    polas1's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    0

    Question how to remove bad words from listbox using textbox and button ?

    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.


    Code:
    if listbox1.items.contains(textbox1.text) then
       add it to listbox
    else
        'do not add it to lisbox
    end if
    'loop faster.
    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.

    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.

  2. #2
    Raydenman's Avatar
    Join Date
    Nov 2013
    Gender
    male
    Location
    Italy
    Posts
    261
    Reputation
    10
    Thanks
    810
    My Mood
    Amused
    Quote Originally Posted by polas1 View Post
    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.


    Code:
    if listbox1.items.contains(textbox1.text) then
       add it to listbox
    else
        'do not add it to lisbox
    end if
    'loop faster.
    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.

    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.
    A listbox filter which works like an item-searcher?

  3. #3
    polas1's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    0
    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.

  4. #4
    Dab's Avatar
    Join Date
    Jun 2015
    Gender
    female
    Posts
    5,426
    Reputation
    663
    Thanks
    9,876
    String.Replace("ReplaceThisWith","This")

  5. #5
    polas1's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    0
    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.

  6. #6
    Dab's Avatar
    Join Date
    Jun 2015
    Gender
    female
    Posts
    5,426
    Reputation
    663
    Thanks
    9,876
    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

  7. #7
    polas1's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    0
    Ok i will try and give the answer if it works

  8. #8
    AuT03x3C's Avatar
    Join Date
    Nov 2014
    Gender
    male
    Location
    kernel32.dll
    Posts
    453
    Reputation
    11
    Thanks
    4,561
    My Mood
    Sleepy
    @polas1 what about learning how to use lists?

  9. #9
    yasiny's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Posts
    59
    Reputation
    10
    Thanks
    3,927
    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

  10. #10
    polas1's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    0
    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.

  11. #11
    Dab's Avatar
    Join Date
    Jun 2015
    Gender
    female
    Posts
    5,426
    Reputation
    663
    Thanks
    9,876
    Last edited by Dab1996426; 08-24-2015 at 12:11 PM.

  12. The Following User Says Thank You to Dab For This Useful Post:

    -[Nero..x3 (08-24-2015)

  13. #12
    -[Nero..x3's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    89
    Reputation
    10
    Thanks
    15
    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?'

Similar Threads

  1. [Help Request] How to remove external connections from .jar
    By WhizzMirray in forum Minecraft Help
    Replies: 8
    Last Post: 02-24-2015, 11:59 AM
  2. [Solved] How to remove certain things from inventory?
    By Monsta1 in forum Alliance of Valiant Arms (AVA) Help
    Replies: 1
    Last Post: 04-17-2014, 04:35 PM
  3. Replies: 12
    Last Post: 11-13-2013, 12:27 AM
  4. [Solved] How to remove Optifine Component from Tekkit?
    By chickeninabiskit in forum Minecraft Help
    Replies: 6
    Last Post: 01-22-2013, 11:20 PM
  5. [Tutorial] How to remove auto-nexus from a client
    By Strudul in forum Realm of the Mad God Hacks & Cheats
    Replies: 15
    Last Post: 09-08-2012, 01:03 PM