Hi ramco1917,
You need to add panel control. Inside the panel control you need to display webBrowser.
Please refer below sample.
Namespace
C#
using System.Diagnostics;
VB.Net
Imports System.Diagnostics
Code
C#
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
Starter();
}
}
public void Starter()
{
panel1.Controls.Clear();
string html = "<html><head>";
html += "<meta content='IE=Edge' http-equiv='X-UA-Compatible'/>";
html += "<iframe id='video' src= 'https://www.youtube.com/embed/{0}?autoplay=1' width='1000' height='400' frameborder='0' allow='autoplay'></iframe>";
html += "</body></html>";
WebBrowser webBrowser1 = new WebBrowser();
webBrowser1.DocumentText = string.Format(html, "https://www.youtube.com/watch?v=OpG36-Vcvzw".Split('=')[1]);
webBrowser1.Dock = DockStyle.Fill;
panel1.Controls.Add(webBrowser1);
}
VB.Net
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
For i As Integer = 0 To 10 - 1
Starter()
Next
End Sub
Public Sub Starter()
panel1.Controls.Clear()
Dim html As String = "<html><head>"
html += "<meta content='IE=Edge' http-equiv='X-UA-Compatible'/>"
html += "<iframe id='video' src= 'https://www.youtube.com/embed/{0}?autoplay=1' width='1000' height='400' frameborder='0' allow='autoplay'></iframe>"
html += "</body></html>"
Dim webBrowser1 As WebBrowser = New WebBrowser()
webBrowser1.DocumentText = String.Format(html, "https://www.youtube.com/watch?v=OpG36-Vcvzw".Split("="c)(1))
webBrowser1.Dock = DockStyle.Fill
panel1.Controls.Add(webBrowser1)
End Sub
Screenshot