Jump to content
  • Advertisement
Sign in to follow this  
joole5

c# beginneer programmer

This topic is 514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Help me! 

I am trying to pass a video between forms. 

i created 2 forms and i added button1,button2, listbox1, openfiledialog1 in first form and then i added just a media player in second form. I press button1 and select video then press button2 and the video opens in form2 but i can't do this :( :( 

This is Form1

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 System.IO;

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

        public void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.ShowDialog();

            OpenFileDialog filedialog = new OpenFileDialog();
            
            if (filedialog.ShowDialog() == DialogResult.OK)
                
            {
                
                FileInfo dosyabilgisi = new FileInfo(filedialog.FileName);

               listBox1.Items.Add("" + dosyabilgisi.Name);

            }
            

        }

        public void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            axWindowsMediaPlayer1.URL = openFileDialog1.FileName;
        
        
                }

        public void Form1_Load(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.settings.autoStart = false;

        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.Ctlcontrols.play();
           
        }
    }
}

 And this is form2

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 lord
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
           
        }
    }
}

Form2 is empty :) Show me the way out.

Share this post


Link to post
Share on other sites
Advertisement

maybe you should set the visibility of video player on the second form to "public"

then in form 1 after clicking button2 you should write:

Form2 frm2 = new Form2();


frm2.videoPlayer1.video = some video; // i don't know which component you are using but in here set the video on the second form

// and if you wanted form 2 to be loaded as a dialog :

if(frm2.ShowDialog() == DialogResult.Ok){
 // do somthing
}

I guess this was the answer? or something else you desired?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!