|
-
Jun 12th, 2006, 11:50 PM
#1
Thread Starter
Member
[RESOLVED] RichTextBox Question - Simple
I'm experimenting with MySQL Database connection and modification right now. In my database I have an ArticlesTable which contains hundreds of HTML formatted articles. When I load the contents of these into a RichTextBox, I don't get what I assumed I would get. None of the font-formatting tags are Displayed 'Richly'.
Am I missing the true use of the RichTextBox? If not, how can I get the HTML rendering-results that I'm looking for?
Actually, I would like to have a box like this that I'm typing in if possible 
Jonathan
-
Jun 13th, 2006, 12:18 AM
#2
Re: RichTextBox Question - Simple
Yes you are missing the true use. A RichTextBox displays text in Rich Text Format (RTF). It uses markup tags like HTML but they are completely different tags. Type some text into a RichTextBox and then take a look at its Rtf property for an example. If you want to render HTML then you use a WebBrowser control. Of course, you can't type into that. There are probably WYSIWYG HTML editor controls available for the .NET platform but I doubt that they're free. An alternative would be to convert the HTML to RTF yourself before displaying in an RTB, then convert back to HTML afterwards. Any complex formatting in either would require some work to convert though. Another alternative would be to use Microsoft Word to do the conversion as it understands both formats. It would have to be installed to be used though, and it's not known for producing "clean" HTML code.
-
Jun 13th, 2006, 12:35 AM
#3
Thread Starter
Member
Re: RichTextBox Question - Simple
Sounds good;
I suppose I could build a simple little text-formatting thing. Thank you for the input though 
Jonathan
-
Jun 13th, 2006, 10:22 AM
#4
Thread Starter
Member
Re: RichTextBox Question - Simple
Is it possible to get a webbrowser (within VB) to display the .text of a textbox and include HTML formatting?
So I can edit the html code in my textbox, and view it in a browser.
-
Jun 13th, 2006, 10:50 AM
#5
Thread Starter
Member
Re: RichTextBox Question - Simple
WebBrowswer1.DocumentText = TextBox1.Text
That solves the problem 
Also, you can apply source-formatting buttons by doing this:
Create a button, "Make Text Bold" ... When this button is pressed, have it perform the following action
TextBox1.SelectedText = "<b>" & TextBox1.SelectedText & "</b>"
This will add HTML bold tags around whatever is selected.
Hope this helps!
Jonathan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|