Hey.

I have problem.
How i can change options in form2 from form1?

public: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
			   this->Form1::Show();
			video^ video2 = gcnew video();
			video2->Show();
			
		 }
public: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
			video^ video2 = gcnew video();
			
			
			video2->axWindowsMediaPlayer2->URL=(listBox1->SelectedItem->ToString());
			video2->axWindowsMediaPlayer2->Ctlcontrols->play();
		 }

I know it's bad, becouse i open 2x new form, but how i can dodge it?

Declare video2 as a private member variable of Form1.

commented: very helpfull +0

Declare video2 as a private member variable of Form1.

can you write how? or some example

Go into your Form1.h and find this section:

public ref class Form1 : public System::Windows::Forms::Form
{
    public:
	Form1(void)
		{
  		    InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

    protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
	~Form1()
	{
		if (components)
		{
			delete components;
		}
	}
	private: System::Windows::Forms::Button^  button1;

and add: private: video ^ video2; to the end. Now you can access it from both methods. Make sure your header for video is included in Form1.h.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.