[RESOLVED] How to make an html preview on using textbox or richtextbox
Hello everyone..I have a problem here regarding to html and html preview..I have 3 tabs and I want the first tab to be plain text..My Second tab will be the html codes wherein i can let the user paste define an html code there. While in the third tab i want it to preview the html...Could anyone help me how to some solution to it? Actually this is the format:
http://i307.photobucket.com/albums/n...-converter.jpg
Thanks in advance for the people who can help me.
Re: How to make an html preview on using textbox or richtextbox
If you are saying you actually want to view the HTML as it would appear in Internet Explorer on the third tab then use a webbrowser control for the HTML Preview tab.
When the user changes tabs away from the HTML source tab, save the contents of the text box containing the source and then when the HTML preview tab is activated use the webbrowser.Navigate method to load it.
Re: How to make an html preview on using textbox or richtextbox
I don't really understand what the difference between the first and second tab is supposed to be. HTML code is just text, after all.
Are you saying that you want syntax highlighting in that second tab?
As for the third tab, you would just use a WebBrowser and assign your HTML code to its DocumentText property.
Re: How to make an html preview on using textbox or richtextbox
Thanks keystone_paul. I will try to look for that webbrowser control for html.
Quote:
Originally Posted by
jmcilhinney
I don't really understand what the difference between the first and second tab is supposed to be. HTML code is just text, after all.
Are you saying that you want syntax highlighting in that second tab?
As for the third tab, you would just use a WebBrowser and assign your HTML code to its DocumentText property.
About for that jm, hmmmp..I think there is no need for that, maybe I will just remove that tab. What really I want is that a user will encode an html format then it can preview as what the browser will shows. Thank you jm for reminding me that. Have a nice day.
Re: How to make an html preview on using textbox or richtextbox
Quote:
Originally Posted by
keystone_paul
When the user changes tabs away from the HTML source tab, save the contents of the text box containing the source and then when the HTML preview tab is activated use the webbrowser.Navigate method to load it.
No need for saving and navigating. As I said, just assign the HTML code directly to the DocumentText property.
Re: How to make an html preview on using textbox or richtextbox
NB - jmcilhinney is right that you can load the text directly without having to save it to a file, however I guess you will want to save the file at some point anyway so its up to you which way to do it.
Re: How to make an html preview on using textbox or richtextbox
Yeah...jm is exactly right..I am working with it right now but could you site some example jm on how to set the document directly to html? Thanks again jm and also to you paul..
Re: [RESOLVED] How to make an html preview on using textbox or richtextbox
richtextbox1.text= "<html><h1>Hello</h1></html>" 'This is html file ( ur richtextbox where html codes are there..
webbrowser1.documenttext = richtextbox1.text ' This is ur webbrowsers whose document text is assigned whatever u have in richtextbox1.text ...
Hope this helps...
Re: [RESOLVED] How to make an html preview on using textbox or richtextbox
Quote:
Originally Posted by
yogesh12
richtextbox1.text= "<html><h1>Hello</h1></html>" 'This is html file ( ur richtextbox where html codes are there..
webbrowser1.documenttext = richtextbox1.text ' This is ur webbrowsers whose document text is assigned whatever u have in richtextbox1.text ...
Hope this helps...
Isn't that exactly what JMcilhinney said?
Re: [RESOLVED] How to make an html preview on using textbox or richtextbox
Quote:
Originally Posted by
keystone_paul
Isn't that exactly what JMcilhinney said?
yeah it is:D
Re: [RESOLVED] How to make an html preview on using textbox or richtextbox
some code i use for webbrowser
Code:
htmlEditor.document.execcommand "ForeColor", False, v
htmlEditor.SetFocus
htmlEditor.document.execcommand "Bold", False, Nothing
htmlEditor.SetFocus
htmlEditor.document.execcommand "fontsize", False, cboSize.Text
htmlEditor.SetFocus
htmlEditor.document.execcommand "fontname", False, cboFont.Text
htmlEditor.SetFocus
htmlEditor.document.execcommand "underline", False, Nothing
htmlEditor.SetFocus
End Sub
htmlEditor.document.execcommand "Italic", False, Nothing
htmlEditor.SetFocus
'Insert image from file
htmlEditor.document.execcommand "InsertImage", "C:\Image234.jpg"
'Open picture dialog
htmlEditor.Document.execCommand "InsertImage", True
Re: [RESOLVED] How to make an html preview on using textbox or richtextbox
Quote:
Originally Posted by
keystone_paul
Isn't that exactly what JMcilhinney said?
yes it is.. anyway I mark already this thread as resolved..Thank You everyone for the help.