CodeItBetter Programming Another VB Programming Blog

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:

  1. How to Search & Replace the Line for Given Search String in a text file
  2. How to Find a String within another String with many options
  3. Replacement for VB6′s Replace$ function (fastest way)
  4. Search & Delete the Line for Given Search String in a text file
  5. How to replace a character in middle of the string
  6. How to Strip/Remove Text from a given String
  7. How to Search & delete a string in text File
  8. How to replace a line for particular line number
  9. How to add a New Line to Existing Text Box Text Programmatically
  10. How to Replace Multiple Substrings in a String at Once

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.