Home > How-To Library > String Manipulation

How to Replace a string on first line of a text box.

**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * ****************************************************************
Private Sub Command1_Click() Dim lPos As Long lPos = InStr(Text1.Text, vbCrLf) If lPos = 0 Then lPos = Len(Text1.Text) + 1 Text1.Text = Replace(Left$(Text1.Text, lPos - 1), "a", "b") & Mid$(Text1.Text, lPos) End Sub

If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.