Results 1 to 3 of 3

Thread: 2 textbox questions

  1. #1

    Thread Starter
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Check out the RichTextBox control. It can do what you want (concerning colors of your tags). You would have to use SelColor property to assign the desired color.

    Code:
    Public Sub ColorTag(pRich As RichTextBox, pstrTag As String, pColor As Long)
        Dim iPos As Integer
    
        iPos = 1
        iPos = InStr(iPos, pRich.Text, pstrTag)
        Do While iPos
            pRich.SelStart = iPos
            pRich.SelLength = Len(pstrTag)
            pRich.SelColor = pColor
            iPos = InStr(iPos + Len(pstrTag), pRich.Text, pstrTag)
        Loop
    End Sub
    Usage: ColorTag RichTextBox, TagToColor, Color
    Example: ColorTag RichText1, "<HTML>", vbBlue

    You can also use an RGB function gor the color.


    For your second question you can do something like this:

    Text1.SelText = "MyText"

    This will insert the text where the cursor is.

    ------------------

    Serge

    Software Developer
    [email protected]
    ICQ#: 51055819


  2. #2
    Junior Member Anthrax's Avatar
    Join Date
    Oct 1999
    Location
    Maine, USA
    Posts
    29

    Post

    I am creating a web page editor and I would like to make the tags a seperate color from the rest of the text (like the Code windows in VB).

    Also... is there a way to input text to a textbox where the curser is instead of the end?

    thanks

    [This message has been edited by Anthrax (edited 01-01-2000).]

  3. #3
    Junior Member Anthrax's Avatar
    Join Date
    Oct 1999
    Location
    Maine, USA
    Posts
    29

    Post

    Thanks, it worked great, but now I have another problem.

    I set the scrollbars on the ritch text box to bolth horizontal and vertical but when text reaches the edge of the box, it starts a new line.


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