Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6065131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:21:24+00:00 2026-05-23T09:21:24+00:00

Hi I currently have a texbox that prints out info to the user when

  • 0

Hi I currently have a texbox that prints out info to the user when they press diffrent buttons. I was wondering if there was a way to make only some of my text bolded while the rest isnt.

Ive tried the following:

textBox1.FontWeight = FontWeights.UltraBold;
textBox1.Text. = ("Your Name: " );
TextBox1.FontWeight = FontWeights.Regular;
textBox1.Text += (nameVar);

Only problem is that using this way will either make everything bold or nothing.
Is there a way to do this? Im using WPF project in C#

Any Comments or suggestions are appreciated.
Thanks!

EDIT: So now im trying to do the RichText box that you all suggested but I cant seem to get anything to appear in it:

// Create a simple FlowDocument to serve as the content input for the construtor.
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("Simple FlowDocument")));
// After this constructor is called, the new RichTextBox rtb will contain flowDoc.
RichTextBox rtb = new RichTextBox(flowDoc);

rtb is the name of my richtextbox i created in my wpf

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:21:24+00:00Added an answer on May 23, 2026 at 9:21 am

    use a RichTextBox, below a method that i have wrote for this problem – hope it helps 😉

    /// <summary>
    /// This method highlights the assigned text with the specified color.
    /// </summary>
    /// <param name="textToMark">The text to be marked.</param>
    /// <param name="color">The new Backgroundcolor.</param>
    /// <param name="richTextBox">The RichTextBox.</param>
    /// <param name="startIndex">The zero-based starting caracter position.</param>
    public static void ChangeTextcolor(string textToMark, Color color, RichTextBox richTextBox, int startIndex)
    {
        if (startIndex < 0 || startIndex > textToMark.Length-1) startIndex = 0;
    
        System.Drawing.Font newFont = new Font("Verdana", 10f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 178, false);
        try
        {               
            foreach (string line in richTextBox.Lines)
            { 
                if (line.Contains(textToMark))
                {
                    richTextBox.Select(startIndex, line.Length);
                    richTextBox.SelectionBackColor = color;
                }
                startIndex += line.Length +1;
            }
        }
        catch
        { }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

what i currently have is the main form that then when a user presses
I currently have a user control that is used on both an /Address/Edit and
Currently have a drop down menu that is activated on a hover (from display:none
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty
I currently have one project that currently contains multiple packages. These packages make up
I currently have a deployed app (fortworth.herokuapp.com) that I am attempting to sort movies
I'm currently working with a textbox that has a background. I was wondering if
I currently have a DetailsView (used to be a Formview, but that is a
Currently I have a webform that has a series of links. What I'd like
I currently have a site with multiple articles being user-generated as content. On each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.