How to Replace a string on first line of a text box.
Posted on January 4, 2009
1 2 3 4 5 6 7 | 'String Manipulation - How to Replace a string on first line of a text box. 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 |
Related posts:
- How to Search & Replace the Line for Given Search String in a text file
- How to Find a String within another String with many options
- Replacement for VB6′s Replace$ function (fastest way)
- Search & Delete the Line for Given Search String in a text file
- How to replace a character in middle of the string
- How to Strip/Remove Text from a given String
- How to Search & delete a string in text File
- How to replace a line for particular line number
- How to add a New Line to Existing Text Box Text Programmatically
- How to Replace Multiple Substrings in a String at Once