0

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?

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by jonsca
0

Declare video2 as a private member variable of Form1.

can you write how? or some example

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.