[VB6] How Do I Work With The RichTextBox?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: [VB6] How Do I Work With The RichTextBox?

Hybrid View

  1. #1
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,074

    [VB6] How Do I Work With The RichTextBox?

    Q: How Do I Add A Rich TextBox To My Application?

    A: Click Project, Components, and Select Microsoft Rich TextBox from the list

    Q: How Do Align Text In A RichTextBox?

    A: The Following Will Align The Text In The Center. Left And Right Are Similar :

    Code:
    Private Sub cmdCenter_Click()
    
        'Center Align
        rtfText.SelAlignment = rtfCenter
        
    End Sub
    Q: How Do I Format The Text, Bold, Italic Or Underline?

    A: The Next Segment Will Bold, Italicise, Underline Text :

    Code:
    Private Sub cmdBold_Click()
    
        'Bold
        rtfText.SelBold = Not rtfText.SelBold
    
    End Sub
    
    Private Sub cmdItalic_Click()
        
        'Italic
        rtfText.SelItalic = Not rtfText.SelItalic
    
    End Sub
    
    Private Sub cmdUnderline_Click()
        
        'Underline
        rtfText.SelUnderline = Not rtfText.SelUnderline
        
    End Sub
    Q: How Do I Change The Text Colour?

    A: The Next Segment Shows How To Change A Color, With The Use Of The CommonDialog Component, Which Must Be Added By Clicking Project, Components, And Selecting It From The Available List.

    Code:
    Private Sub cmdColor_Click()
        
        'CommonDialog To Show Colours
        CD.Flags = cdlCFBoth 'Show All Colours
        CD.ShowColor
        rtfText.SelColor = CD.Color 'Set Colour
        
    End Sub
    A Full Example Of The RTB In Working Is Attached
    Attached Files Attached Files
    Last edited by HanneSThEGreaT; May 12th, 2010 at 08:15 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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center