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 5999477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:33:28+00:00 2026-05-23T00:33:28+00:00

If I have a RichTextBox and want output like the first line is a

  • 0

If I have a RichTextBox and want output like the first line is a font with capital letters and bold, while the next line on the contrary, what should I do?

output like this:

MY NAME IS
Diana
My address is
China

  • 1 1 Answer
  • 2 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-23T00:33:29+00:00Added an answer on May 23, 2026 at 12:33 am

    Hey try this, it works, but you might see the text flicker for a second if the user types really fast, like holding down “Enter” and etc.

        private void Form_Load(object sender, EventArgs e)
        {
            // append the function to the RichTextBox's TextChanged event
            MyRichTextBox.TextChanged += Capitalize_Bold_FirstLine;
        }
    
        private void Capitalize_Bold_FirstLine(object sender, EventArgs e)
        {
            RichTextBox box = sender as RichTextBox;
            if (box != null && box.Text != "")
            {
                // get the current selection text of the textbox
                int ss = box.SelectionStart;
                int sl = box.SelectionLength;
                // get the position where the first line ends
                int firstLineEnd = box.Text.IndexOf('\n');
                if (firstLineEnd < 0)
                    firstLineEnd = box.Text.Length;
    
                // split the lines
                string[] lines = box.Text.Split('\n');
                // capitalize the first line
                lines[0] = lines[0].ToUpper();
                // join them back and set the new text
                box.Text = String.Join("\n", lines);
                // select the first line and make it bold
                box.SelectionStart = 0;
                box.SelectionLength = firstLineEnd;
                box.SelectionFont = new Font(box.Font, FontStyle.Bold);
                // select the rest and make it regular
                box.SelectionStart = firstLineEnd;
                box.SelectionLength = box.Text.Length - firstLineEnd;
                box.SelectionFont = new Font(box.Font, FontStyle.Regular);
                // go back to what the user had selected
                box.SelectionStart = ss;
                box.SelectionLength = sl;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF RichTextBox control that I want to behave like a normal
I have added XRRichTextbox into XtraReport, i just want to bind HTML into RichTextbox
I have a richtextbox in an app and I'd like key words to be
I have a Windows Forms application that on it I have a RichTextBox, like
Basically, I have a RichTextBox and I want to convert the formatted contents of
I have a .rtf file and want to put it in a richtextbox in
I have a RichTextBox and I want to save the text to a file.
I have a richtextbox that I want to search and replace only WHOLE words.
I have richtextbox and preview dialog. when I want to make a preview I
Alright, Question #1: well i have a richtextbox, and id like to add emotions

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.