Ok, this shouldn't be a tough one if you're good at VB:
I wrote a function that replaces a certain string in a text with another one.
This is the function:
Public Function ReplaceString(OriginalString As String, StringToRem As String, StringToInsert As String) As String
If InStr(1, OriginalString, StringToRem, 0) > 0 Then
ReplaceString = Left(OriginalString, InStr(1, OriginalString, StringToRem, 0) - 1) & StringToInsert & Right(OriginalString, Len(OriginalString) - Len(StringToRem) - InStr(1, OriginalString, StringToRem, 0) + 1)
Else
ReplaceString = OriginalString
End If
End Function
now, there is a problem with this definition:
Private Sub Command1_Click()
Text1.Text = ReplaceString(Text1.Text, old.Text, new.Text)
End Sub
It works when I write it like this:
Private Sub Command1_Click()
Text1.Text = ReplaceString(Text1.Text, "hi", "hello")
End Sub
In this case, it replaces the string "hi" with "hello", but I want to set both strings in two textboxes. Anyone knows the answer?
Thanks a lot
