Results 1 to 5 of 5

Thread: Find a Words and delete them ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    125

    Find a Words and delete them ?

    HI
    I make Text1 it contain this Words:
    PHP Code:
    IYAD OMAR Hassan Mustafa
    ZYAD OMAR Hassan Mustafa
    AHMED OMAR Hassan Mustafa
    KHALED OMAR Hassan Mustafa 
    i need code to find (Mustafa and Omar & IYAD) and delete them ????

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Find a Words and delete them ?

    vb Code:
    1. Text1.Text = Replace(Text1.Text, "Mustafa", "", , , vbTextCompare)
    2.     Text1.Text = Replace(Text1.Text, "Omar", "", , , vbTextCompare)
    3.     Text1.Text = Replace(Text1.Text, "IYAD", "", , , vbTextCompare)
    ...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3
    Junior Member
    Join Date
    Jun 2010
    Posts
    31

    Re: Find a Words and delete them ?

    Code:
    Dim S As String, RS As String
    
    S = Text1.Text
    
    RS = Replace(S, "Mustafa", vbNullString, , , vbTextCompare)
    RS = Replace(RS, "Omar", vbNullString, , , vbTextCompare)
    RS = Replace(RS, "IYAD", vbNullString, , , vbTextCompare)
    
    'Removing any extra spaces (double spaces or more) that may be present after removing the sub strings
    Do While InStr(RS, "  ")
    RS = Replace(RS, "  ", " ")
    Loop
    
    'Removing any leading or trailing spaces that may be present after removing the sub strings
    Text1.Text = Trim(RS)
    If you only want to remove a specific casing of the word(s) just remove the , , , vbTextCompare
    Last edited by Jackkkkk; Oct 16th, 2010 at 02:30 AM.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    125

    Re: Find a Words and delete them ?

    ThAnks You aLL

  5. #5
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Find a Words and delete them ?

    Quote Originally Posted by iyadd View Post
    ThAnks You aLL
    We are happy to help

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width