Wednesday, May 2, 2012

Using Replace (String Function) in Visual Basic 6

Example: I want to replace "a" with "A" in Textbox1 and put the replaced string into Textbox2.
You can't use it directly like this.

Text2.Text = Replace(Text1.Text, "a", "A")

You must make use of variable, like this.


Dim TempVar As String
TempVar = Replace(Text1.Text, "a", "A")
Text2.Text = TempVar


Then the code will work. More info here.



No comments:

Post a Comment