Results 1 to 4 of 4

Thread: [RESOLVED] again simple Q

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Resolved [RESOLVED] again simple Q

    i have three text boxes

    text1.text one line
    text2.text one line
    text3.text several lines


    i need to search text3.text line by line
    if i found one of the lines = text1.text then
    replace this line with text2.text

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: again simple Q

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     Dim linesArr() As String
    5.         linesArr() = Split(Text3.Text, vbCrLf)
    6.     Dim i As Integer
    7.         For i = 0 To UBound(linesArr)
    8.             If Trim(linesArr(i)) = Trim(Text1.Text) Then
    9.                 linesArr(i) = Trim(Text2.Text)
    10.             End If
    11.         Next i
    12.     Text3.Text = Join(linesArr, vbCrLf)
    13. End Sub

  3. #3
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: again simple Q

    Text3.Text = Mid(Replace(vbCrLf & Text3.Text, vbCrLf & Text1.Text, vbCrLf & Text2.Text, vbTextCompare), 3)

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: again simple Q

    leinad31 thank you very much this is what i need


    thanks alot gavio
    Last edited by om-yousif; Nov 30th, 2006 at 10:49 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width