0

Possible Duplicate:
Format text in Rich Text Box

I have a rich text box and a string that I get from a user inputting it into a text box. I want to take that string and bold it all. Any ideas?

Here is the string I have now and it's format:

if (InputBox("Please enter a username", "Username:", ref value) == DialogResult.OK)
{
    usr = string.Format("[" + value + "]: ", bold);          
}

and the bold variable

Font bold = new Font(dispBox.Font, FontStyle.Bold);

This method does not currently work for me, so any help is appreciated.

Community
  • 1
  • 1

1 Answers1

0

As mentioned by mbeckish, this seems to be a duplicate to link they have provided. But to summarize, your issue is that you are not using the properties/methods associated with a RichTextBox in order to get the string formatted the way you would like.

You will need to use the SelectionFont Property in order to achieve what you are looking to do.

Andrew Backes
  • 1,884
  • 4
  • 21
  • 37