

For that, I suggest you raise the issue in the relevant forum. net framework 4.7.2 framework but it is just not working with the project that is upgraded from 2.0 to 4.7.2 then I think the issue is somewhere in the project. If you are saying that the above example is working fine with the newly created. Note: The logic will remain the same even if you try to access the webView2 in the class from another project. (item as WebView2).CoreWebView2.Navigate(url) įorm2 code: private void button1_Click(object sender, EventArgs e) String url = " await (item as WebView2).EnsureCoreWebView2Async(null) Public async Task abcAsync(string formname, string name)įorm form = (Form)Application.OpenForms We will click the button to launch the Form2.įurther, we will click the button on Form2 that we call the method from class to initialize the webView2. Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this Mutalikdesai ,įrom your previous comment, I understand that you are trying to initialize the webView2 from the class file.įorm1 contains the button and webView2. If the response is helpful, please click "Accept Answer" and upvote it.


Private void button1_Click(object sender, EventArgs e) Private void button2_Click(object sender, EventArgs e)įorm2 code: private Form1 mainForm = null String url = " await webView21.EnsureCoreWebView2Async(null)

Let's say, I have 2 Forms in my Application. I suggest you call the method of the form that contains the code for the webView2.
