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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:01:29+00:00 2026-05-16T18:01:29+00:00

When I am building my typing tutor application the errors user made I want

  • 0

When I am building my typing tutor application the errors user made I want to show it in RED into his textbox. I created a LIST to have the index values stored but cannot figure it out how to retieve it and make them display as RED COLOR in UserTexbox. Anyways here is my code:

void ShowErrors()
{
    try
    {
        List<int> lst = new List<int>();
        string sample, user;
        sample = TBox_Sample.Text; //Sample Text Given to the user
        user = TBox_User.Text;     //User input string
        for (int i = 0; i < sample.Length; i++)
        {
            if (sample[i] != user[i])
            {
                lst.Add(i);   //Made this list which contains indexes of errors positioned.

            }

        }

        string user_new = TBox_User.Text.ToString();

        for (int j = 0; j <= lst.Count; j++)
        {
            ??? I WANT TO SHOW IN 'TBox_User' ALL ERRORS MARKED WITH RED WITH THE HELP OF MY LIST OBJECT: LST !!! 
        }
    }
    catch (IndexOutOfRangeException)
    {
        MessageBox.Show("There is no input from the user!");
        //int ijj = 0;
    }
    catch (Exception)
    {
        MessageBox.Show("Unknown Error!");
    }
  • 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-16T18:01:30+00:00Added an answer on May 16, 2026 at 6:01 pm

    You should be using a RichTextBox instead of a TextBox, that way you can either change the SelectionStart, SelectionLength, and SelectionColor, or modify the Rtf directly. Otherwise with a normal textbox you would be looking at overriding WndProc and doing some custom painting in the control which is quite a bit of work. Here is a quick example of using a RichTextBox to do this (all you would have to do is update your TextBox to RichTextBox and change your for-loop to the following:

    foreach (int index in lst) {
        richTextBox.SelectionStart = index;
        richTextBox.SelectionLength = 1;
        richTextBox.SelectionColor = Color.Red;
    }
    

    Let me know how it works for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't
Building a new ASP.net application, and planning to separate DB, 'service' tier and Web/UI
Building an iPhone OS application that will allow users to anonymously post information to
I´m building a small application with Jquery and PHP. Jquery (index.html) adds Form Fields
I'm building a website in Django, and I want one of my datatypes to
I'm building a little tool that lets user to place some geometric figures on
I'm building a music library program, and I want to have the ability to
I've building a very basic iphone app where the user will be able to
Rails Newb here asking his first question.... I'm building a personal blog-style website that
I am building a application with to do checklist in it. In this is

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.