'c# is it possible to show a live webpage in a windows form application?
I was wondering if its possible to show a webpage inside of a windows form application. I'm trying to create a livechat client,but it seems to hard for a c# beginner,since I have to code the server side also. So I was wondering if it's possible to show a php page containing the chat client into a window of my application?
Thanks in advance for any replay!
Solution 1:[1]
Yes, you can do it with WebBrowser control. Place it to your form and call Navigate method:
browser.Navigate("http://www.google.com");
Solution 2:[2]
Yes, use a WebBrowser control. It does exactly what you're describing: show a web page from within a winforms application. It is essentially Internet Explorer from within a control.
Solution 3:[3]
Yes, there is a WebBrowser control available in windows forms. You can navigate this page to any webpage you would like.
Solution 4:[4]
you can try CefSharp.WinForms.
it is more easier than webbrowser control.
After you add all it's reference dll
just use this simple line of code:
uri = "https://www.google.com/";
ChromiumWebBrowser browser = new ChromiumWebBrowser(uri);
panel.Controls.Add(browser);
browser.Dock = DockStyle.Fill;
Solution 5:[5]
I would suggest to use Webview2 instead of the old web browser control, as it supports many modern html/css features.
To use it, in project package manager (assuming you're using MS Visual Studio) search for WebView2 and install the Microsoft's one; then a "WebView2" control will appear in form designer toolbox. Drag it onto the form to add it.
For more information, read the official documentation on Microsoft's site: "Get started with WebView2 - Microsoft Edge Development | Microsoft Docs" https://docs.microsoft.com/en-us/microsoft-edge/webview2/get-started/get-started
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Devin Burke |
| Solution 3 | Devin Burke |
| Solution 4 | Chhornkimchheng |
| Solution 5 |
