0

I need to automatically open a webpage via script (C#) using a Microsoft Visual Basic Form and C# Project. My script automatically opens the webpage via invoking a click event, but instead of opening in the form, the new site opens in a new web browser (Microsoft Edge) rather than a web-browser component I have placed in the Form.cs form. How can I accomplish this?

DETAILS: I am able to open a website in a web browser component in my form. There is a button on the website which I need to press to access another website. The website, however, does not open up in the same web browser component on the form - it opens up in a new window or tab in a new browser. I need to access the website this button is directing me to, but it has to be in the webbrowser component on my form.

There are two ways which allow me to access the website:

  1. By manually clicking on the button in the webbrowser component on the form
  2. By using script to click on the button: webBrowser1.Document.GetElementById("item_file_manager").InvokeMember("Click");

The reason why I want it in the same form is so I can continue to navigate to a correct, final website and upload a file to the site. I am trying to modify a site of my own and am trying to update the site with the click of a button.

Thank you for your help.

Shaun
  • 13
  • 1
  • 3
    Does this answer your question? [How do I display a popup from a WebBrowser in another window I created?](https://stackoverflow.com/questions/6470842/how-do-i-display-a-popup-from-a-webbrowser-in-another-window-i-created) – 41686d6564 stands w. Palestine Aug 23 '20 at 19:58

1 Answers1

0

let's say you have a WebBrowser components called webBrowser1 with a TextBox associated to input URL and a button to confirm the navigation You can invoke the Navigate function which takes the Url in parameter. webBrowser1.Navigate(the url).

see the MSDN