none
Show a webpage in richtextbox

    Question

  • Hey,

    I have a richtextbox in the richtextbox must show a webpage.
    The url of the webpage is in textbox1.
    How can i show the webpage in richtextbox?
    It's then show the source code of webpage
    I will not use the webbrowser control.

    I can't find the right code!
    Can you help me???
    Saturday, September 13, 2008 8:07 PM

Answers

  •  If i make a webbrowser control then is the webiste showing in a richtextbox?

    No, you will be rendering HTML onto a webbrowser control.

    Why can't i show a webpage in a richtextbox?

    A rich text box only knows how to render plain text or RTF formatted text. HTML is a totally different format than RTF. RTF is a relatively simple format and does not support the sorts of advanced capabilities available in HTML (DOM, Scripting, HTML markup, etc.). In short, RTF and HTML are basically incompatible formats.

    Sorry...

    Dan Rhea
    Monday, September 15, 2008 8:28 PM
  • THIS WILL REALLY SIMPLIFY THE PROCESS FOR YOU! DON'T WASTE YOUR TIME ON THE RICHTEXTBOX!

    --

    There is no easy way to show a webpage in a rich text box as you would see it in Internet Explorer or Google Chrome etc. 

    What you should really is the Webbrowser tool in the toolbox under common controls. It automatically creates navigation buttons and a control constructed for webpages. 

    You can edit the webbrowser properties in the properties box and also through code.

    For example:

    To get the browser to navigate forwards use: WebBrowser1.GoForward()
    To get the browser to navigate backwards use: WebBrowser1.GoBack()
    To get the browser to go to the homepage use: WebBrowser1.GoHome()
    To get the browser to navigate to a specific file or URL use: WebBrowser1.Navigate("http://social.msdn.microsoft.com/")

    Then what you could do is get the program to load the webpage's source code from the webBrowser control to the RTB. It don't know how to do that.

    By the way, if you are planning on using your program to copy source code - beware, it's ILLEGAL!

    Thanks, Callum Kerr
    Saturday, September 13, 2008 8:45 PM
  • WILLIAMXXX said:

     I will not use the webbrowser control!!!


    If you want to view a web page, you need an HTML renderer of some kind. The only built-in one is the web browser control. You can't use an RTB. What is your objection to the web browser control?

    Stephen J Whiteley
    Sunday, September 14, 2008 2:15 AM
    Moderator

All replies

  • THIS WILL REALLY SIMPLIFY THE PROCESS FOR YOU! DON'T WASTE YOUR TIME ON THE RICHTEXTBOX!

    --

    There is no easy way to show a webpage in a rich text box as you would see it in Internet Explorer or Google Chrome etc. 

    What you should really is the Webbrowser tool in the toolbox under common controls. It automatically creates navigation buttons and a control constructed for webpages. 

    You can edit the webbrowser properties in the properties box and also through code.

    For example:

    To get the browser to navigate forwards use: WebBrowser1.GoForward()
    To get the browser to navigate backwards use: WebBrowser1.GoBack()
    To get the browser to go to the homepage use: WebBrowser1.GoHome()
    To get the browser to navigate to a specific file or URL use: WebBrowser1.Navigate("http://social.msdn.microsoft.com/")

    Then what you could do is get the program to load the webpage's source code from the webBrowser control to the RTB. It don't know how to do that.

    By the way, if you are planning on using your program to copy source code - beware, it's ILLEGAL!

    Thanks, Callum Kerr
    Saturday, September 13, 2008 8:45 PM
  •  I will not use the webbrowser control!!!
    Saturday, September 13, 2008 9:38 PM
  • WILLIAMXXX said:

     I will not use the webbrowser control!!!


    If you want to view a web page, you need an HTML renderer of some kind. The only built-in one is the web browser control. You can't use an RTB. What is your objection to the web browser control?

    Stephen J Whiteley
    Sunday, September 14, 2008 2:15 AM
    Moderator
  • So what is the point of viewing the webpage in the RTB? If I may take a guess, are you trying to load html from a texbox or something?

    Sunday, September 14, 2008 5:22 AM
  • Let me put this crystal clear for you William: You *cannot* load a webpage into a textbox. 

    By the sounds of things, you want to use this program to copy source code, which by the way, is illegal.

    Thanks, Callum Kerr
    Sunday, September 14, 2008 9:26 AM
  • Actually... copying somebody's source code isn't illegal. If you then post it somewhere and claim it's your own, that's illegal.
    Sunday, September 14, 2008 3:18 PM
  • I am not getting your point of showing web page in text box.. you cannot do that unless using the browser control.

    If you want the source code of the certain web page to be displayed in the text box then go to

    This might help you out.

    Prateek Regmi Blog for Programmers
    Monday, September 15, 2008 12:00 AM
  • If i make a webbrowser control then is the webiste showing in a richtextbox?

    Why can't i show a webpage in a richtextbox?
    Monday, September 15, 2008 3:10 PM
  •  If i make a webbrowser control then is the webiste showing in a richtextbox?

    No, you will be rendering HTML onto a webbrowser control.

    Why can't i show a webpage in a richtextbox?

    A rich text box only knows how to render plain text or RTF formatted text. HTML is a totally different format than RTF. RTF is a relatively simple format and does not support the sorts of advanced capabilities available in HTML (DOM, Scripting, HTML markup, etc.). In short, RTF and HTML are basically incompatible formats.

    Sorry...

    Dan Rhea
    Monday, September 15, 2008 8:28 PM
  • Lttt Mrrr

    Tuesday, September 16, 2008 3:54 PM
  • Yes you can have HTML in a richtextbox as seen here: http://www.codeproject.com/KB/edit/htmlrichtextbox.aspx

    now its not going to render like a web browser and has some deficiencies but its a start you can continue improving it and when your done I'd love to see the improvments I am currently working through a bullets issue its lossing the last one in a list.


    Signature
    Tuesday, December 23, 2008 6:45 PM