Search Tools Links Login

Absolute EASIEST Way To Find And Replace Text in Any Control!!


Absolute Easiest Way To Find And Replace Text in Any Control - ie: labels, textboxes, basically ANY control that supports text editing!!

Original Author: !nnovation Software

Inputs

just make 3 textbox's and a command button, leave default names.

Assumptions

uses the Replace function in VB6.

Code

Private Sub Command1_Click()
Text1.Text = Replace(Text1.Text, Text2.Text, Text3.Text, 1, , vbTextCompare)
'here's how it works:
  ' where text1.text is , thats the source of what ur looking in, ex: a label or text box
  ' where text2.text is , that's what u are looking for
  ' where text3.text is , thats what u want to replace what u find with
  ' leave everything else alone after that
  
  
Text2.Text = "Find What?"
Text3.Text = "Replace With What?"
End Sub
Private Sub Form_Load()
Text2.Text = "Find What?"
Text3.Text = "Replace With What?"
Text1.Text = "Type Text in Here"
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 87 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.