Windows Forms: Add / Embed YouTube Videos in C#

Add / Embed Flash Player to Windows Form Application allows you to view YouTube Videos in C#

Step 1Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "FlashEmbed" and then click OK

c# flash embedStep 2: Design your form as below

flash embed in c#

Step 3: Add a reference to AxShockwaveFlashObjects library

AxShockwaveFlashObjects

Step 4: Add code to handle your form as below

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FlashEmbed
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnGo_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtUrl.Text))
            {
                //Get url video
                string url = txtUrl.Text.Replace("watch?v=", "v/");
                axShockwaveFlash.Movie = url;
                axShockwaveFlash.Play();
            }
        }
    }
}

VIDEO TUTORIALS