Results 1 to 3 of 3

Thread: Find & Replace Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2008
    Posts
    16

    Find & Replace Problem

    I'm trying to do a 'find/replace' sort of thing, but for some reason the Replace function isn't working. It says it cannot be indexed because it has no default property. How do I do the replace correctly?

    Here's my code:
    Code:
    Dim aString As String
    aString = Replace(DirectCast(Form1.SplitContainer1.ActiveControl, RichTextBox).Text, Me.TextBox1.Text, Me.TextBox2.Text)

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Find & Replace Problem

    Are you certain the active control is a RichTextBox when you call that? The way you're ''supposed'' to do it is like so:

    Code:
    RichTextBox1.Text = RichTextBox1.Text.Replace(Me.TextBox1.Text, Me.TextBox2.Text)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2008
    Posts
    16

    Re: Find & Replace Problem

    Yes, it is active. Ah, that's how you do it. Thanks.

Tags for this Thread

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