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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:58:24+00:00 2026-05-27T00:58:24+00:00

I have text with wild characters, like @ARed text where @A is sign for

  • 0

I have text with “wild characters”, like “@ARed text” where @A is sign for red colour. I need to replace @A with some function (or something like that) so wherever there is @A in text, text font becomes red coloured. I have several colours (@B, @C…) so for every of them I need to do same thing, just different colour.

So, “@ASome red text @BSome green text” would be coloured red and green respectively (can’t find text colouring here on SO).

Any ideas?

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-27T00:58:25+00:00Added an answer on May 27, 2026 at 12:58 am

    What I would do is capture the PreRender event of the label and test for YourLabel.Text.Substring(0, 1) and if that is the at-sign (@) then conditionally test (I’d use a switch) the second character. You can then get the rest of the string without the @A and set the Label’s text then, and format according to the property characters.

    Something like this:

    protected void YourLabel_PreRender(object sender, EventArgs e)
    {
        string LabelText = YourLabel.Text;
        bool NewForeColor = false;
    
        if (LabelText.Left(0, 1) == "@")
        {
            switch(LabelText.Substring(1, 1))
            {
                case "A":
                    YourLabel.ForeColor = System.Drawing.Color.Magenta;
                    NewForeColor = true;
                    break;
                case "B":
                    // you get the idea
                    break;
            }
            if (NewForeColor)
                YourLabel.Text = LabelText.Substring(2, LabelText.Length - 2);
        }
    }
    

    Edit: this is untested code, but you should get the general idea of the logic.

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

Sidebar

Related Questions

I have text file with some stuff that i would like to put into
I have text data (in R) and want to replace some characters with other
I have text file with something like first line line nr 2 line three
i have text like this div bla-bla end div i need to get only
I have text-box in some form in access 2007. I am trying to replace
I have text files that have list of thousands of names like this DallasWebJobs
I have text field that may contain html text (like <b>Dickens</b> ) in razor
I have text with alot of non-standard characters and they are stored like this
I have text files with a lot of uniform rows that I'd like to
I have text field where user need to write some numbers. Is there any

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.