-2

i am new to .net i am having trouble playing videos automatically. I would be showing different textboxes here but i want the video to autplay without any buttons

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;
using WMPLib;

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

        private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
        {
             AxWindowsMediaPlayer1.URL = "C:\Users\Ramrod\Documents\Visual Studio 2012\Projects\ThinkQDisplay\ThinkQDisplay\sample.avi";
        }
    }
}

It keeps telling it is an unrecognized escape sequence. Also I would like to have a separate form (form2). Where I can choose what to play here on form 1. Is it also possible to have it looped?

Filburt
  • 17,626
  • 12
  • 64
  • 115
  • 1
    Think on what an "escape sequence" would be in a string. – TZHX Feb 08 '17 at 10:48
  • [Giving path of a file in C#](http://stackoverflow.com/a/10083671/205233) and [many more](http://stackoverflow.com/search?q=c%23+unrecognized+escape+sequence+path) for this error message. – Filburt Feb 08 '17 at 10:54
  • yeah i included the ; but it still says the name file does not exist in the current context even though i added using WMPLib; – Michael Dela Cruz Feb 08 '17 at 10:54
  • 2
    Possible duplicate of [Giving path of a file in C#](http://stackoverflow.com/questions/10083651/giving-path-of-a-file-in-c-sharp) – gus27 Feb 08 '17 at 12:12

1 Answers1

1
    private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
    {
         axWindowsMediaPlayer1.URL = @"C:\Users\Ramrod\Documents\Visual Studio 2012\Projects\ThinkQDisplay\ThinkQDisplay\sampler.avi";
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        axWindowsMediaPlayer1.settings.autoStart = true;
    }
}

}