How do I combine font styles in Visual Basic

Posted on 2009-02-22
Last Modified: 2013-11-27
I am working on a Visual Basic 2008 application where I am reading the contents of various RTBs and then consolidating them in another.

In this RTB I have to put some text in bold, some in regular and some in (say) bold and underlined or bold and italics. I can't figure out how to combine the styles.

Can someone please help?

(I'm still finding my way round VB after years working in VC)
Question by:jindalee
    LVL 85

    Accepted Solution

    Not sure exactly what you're asking for...

    For example, if you wanted to make everything in the RichTextBox Bolded, Underlined and Italicized then you would do:

        RichTextBox1.Font = New Font(RichTextBox1.Font, FontStyle.Bold Or FontStyle.Italic Or FontStyle.Underline)
    LVL 1

    Author Closing Comment

    That is exactly what I wanted it to do. Thank you.

    (I'm a C++ programmer dumped into a VB project with a short delivery time frame)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now