Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Error BC30311 : says that, value of type string can't be converted to 'RichTextBox'
Here is the link to the image of my code since you cant post pictures here

What I have tried:

I have tried introducing parameters but that keeps worsening the situation
Posted
Updated 27-Mar-24 1:57am
v2
Comments
Richard MacCutchan 27-Mar-24 7:12am    
No one can guess what your code is doing. Please provide proper details of the code and the data you are trying to process. And trying simple to 'convert' a string into a RichTextBox makes no sense. You need to populate the text box with data.
joseph mahihu 27-Mar-24 7:26am    
I wish there was a way I can show you a picture of this
Richard MacCutchan 27-Mar-24 7:28am    
All you need to do is just edit your question and show us the code that is not working.
Dave Kreskowiak 27-Mar-24 12:29pm    
Copy and paste the relevant code into your question, NOT AN IMAGE OF IT.

1 solution

If you are trying to add structured text into RichTextBox, you are going to be using the Rtf property which accepts a string that has text formatting in it. As you haven't actually shown any code, we can't offer much more support other than saying that you are going to have to deal with the RTF yourself. So, if I wanted to have the following string:
This is extremely bold text with some italics in it and a strikethrough
this is going to end up looking like this as the RTF string.
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang2057{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.22621}\viewkind4\uc1 
\pard\sa200\sl276\slmult1\f0\fs22\lang9 This is extremely \b bold\b0  text with some \i italics\i0  in it and a \strike strikethrough\strike0 .\par
}
 
Share this answer
 

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