Windows Forms and Media Player RRS feed

  • Question

  • Hi Folks

    I am brand new to Windows forms.

    I am working on a application where the user can use a barcode scanner and scan upc's and a video play for that upc.  I am almost there but i need a little help.  I want the text box to be blanked out and ready to receive another scan after the video is done playing.

    I am also having problems with my catch not catching a missing or bad file.

    Also how do i have it so i can publish and have the setup.exe create the correct directory's.  I have a videos directory underneath my Project with one sample video in it. I want the setup to copy that sample over in the install so it can be tested on other machines easily.

    Is there a list somewhere of what options i can set with the windows media player control?

            private void textBox1_TextChanged(object sender, EventArgs e)
                string VideoName;
                string VideoPath;
                VideoName = textBox1.Text.Trim() + ".wmv";
                VideoPath = "C:/PyroPro/Videos/";
                label2.Text = VideoPath + VideoName;
                double time = 20.0;
                if (time <= axWindowsMediaPlayer1.currentMedia.duration)
                    axWindowsMediaPlayer1.Ctlcontrols.currentPosition = time;
                // If the Player encounters a corrupt or missing file, 
                // show the hexadecimal error code and URL.
                    axWindowsMediaPlayer1.URL = @VideoPath + VideoName;
                catch (InvalidCastException)
                // In case pMediaObject is not an IWMPMedia item.
                    MessageBox.Show("Video for That Firework Not onfile.");

    Friday, May 4, 2012 8:02 PM