We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Character Editing

Medium Priority
Last Modified: 2013-12-03
Dear Experts,
    While writing a recent program of mine, I ran into a couple of problems that i side stepped in order to complete the project.  But now since I have the opportunity to go back, I am hoping to fix/solve those problems that i encountered.  Anyway, one of the main problems that I am having, is how to get my program to take a multi-line textbox and go through character by character to see if that character matches one that i specified earlier in the program.  If it does match, I would like it to replace the found character with a new character.
    An example of this would be, in the text box it said...
"Hi, how are you
I would like the program to recognize the comma and replace it with something like a hyphen.  I am using Visual Basic5.0 (sp3) under a windows95 platform.  Please help me out here.
Watch Question

Would you like the program to replace as Text is typed in the TextBox or more like a Search and Replace at a later point?


  I would like it to replace it at a later time.  Like when a menu item is clicked.
Unlock this solution and get a sample of our free trial.
(No credit card required)


    I'm not sure what i'm doing wrong, but that code you gave me does nothing.  I have a multi-line textbox and a menuitem on my form.  i tried that code first in the declarations section of the form first and put the calling code in the menu and it had no result.  Second, i tried putting the code in a module and calling it from there.  Still no result.  Last of all i tried putting the code directly into the menu and still, no result.  Is there something that I'm missing?

please help,


Sorry that you are having trouble...

The Public Sub should be in either the declarations of the form or in a separate BAS module.

The calling code should be in the Event you want to have the Search and Replace to occur.

Did you replace the Text2 with the name of your Textbox?


   I got it working,  thanks,this was a big help.

No problem...

If you have any more problems/questions you can e-mail me @:
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.