I’m using Visual Studio 2010 and I’m putting web browser into my program. So far, I am able to get the page to navigate to the address I type into my TextBox1. However, if i press the back button or forward button, the TextBox1 does not change to the correct website address. How do I write the code so that TextBox1 always shows the correct website name. Please advice, thanks.
Share
I assume you’re using the
WebBrowsercontrol and displaying the current URL in aTextBoxcontrol.In that case, you need to handle the
Navigatedevent of yourWebBrowsercontrol, and inside of that event handler method, update theTextproperty of yourTextBoxcontrol.The
Navigatedevent is raised when theWebBrowsercontrol has navigated to a new document and has begun loading it. The documentation tells you all of the properties/methods that can trigger theWebBrowsercontrol to begin navigating to a new page.The documentation even contains a sample for exactly what you’re doing: