Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
txtDetail.Text += "Header" <-- i wanna make them bold
txtDetail.Text += System.Environment.NewLine + "Item1" <-- i wanna make them Regular
txtDetail.Text += System.Environment.NewLine + "Header1" <-- bold
txtDetail.Text += System.Environment.NewLine + "Items" <-- Regular
Posted
Comments
Sinisa Hajnal 26-Mar-15 7:28am    
What have you tried? How did you try to make it bold?
zhitu 26-Mar-15 23:11pm    
i tried to use these code ->
Font font = new Font(txtDetail.SelectionFont, FontStyle.Bold); it didn't work .
i didn't understand StringBuilder how to use ..
but i got the stringbuilder .
thanks you for helping me out

1 solution

Try:
C#
StringBuilder sb = new StringBuilder();
sb.Append(@"{\rtf1\ansi ");
sb.Append(@"\b Header\b0.\line ");
sb.Append(@"Item1\line ");
sb.Append(@"\b Header1\b0.\line ");
sb.Append(@"Items\line ");
sb.Append("}");
txtDetail.Rtf = sb.ToString();
 
Share this answer
 
Comments
zhitu 26-Mar-15 23:15pm    
Yoooo !
Thanks for the Codes StringBuilder ..
i solved my problem with those codes ..
Thanks a lot :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900