OK

So I am learning c++ and I have created my design using the windows forms,
I now have to do the coding,
I have implemented a code which is returning a nice amount of 102 errors,
Any help would be appreciated or rewarded.

I look forward to learning from an experienced user.

#pragma once


namespace waveplayer {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	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::Panel^  panel1;
	protected: 
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::Button^  button1;
	private: System::Windows::Forms::Button^  button2;
	private: System::Windows::Forms::TabControl^  tabControl1;
	private: System::Windows::Forms::TabPage^  tabPage1;
	private: System::Windows::Forms::ListBox^  listBox1;
	private: System::Windows::Forms::TabPage^  tabPage2;
	private: System::Windows::Forms::Button^  button8;
	private: System::Windows::Forms::OpenFileDialog^  openFileDialog1;
	private: System::Windows::Forms::Button^  button7;
	private: System::Windows::Forms::Button^  button6;
	private: System::Windows::Forms::Button^  button5;
	private: System::Windows::Forms::Button^  button4;
	private: System::Windows::Forms::Button^  button3;
	private: AxWMPLib::AxWindowsMediaPlayer^  axWindowsMediaPlayer1;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
			this->panel1 = (gcnew System::Windows::Forms::Panel());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
			this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
			this->listBox1 = (gcnew System::Windows::Forms::ListBox());
			this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
			this->button8 = (gcnew System::Windows::Forms::Button());
			this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
			this->button7 = (gcnew System::Windows::Forms::Button());
			this->button6 = (gcnew System::Windows::Forms::Button());
			this->button5 = (gcnew System::Windows::Forms::Button());
			this->button4 = (gcnew System::Windows::Forms::Button());
			this->button3 = (gcnew System::Windows::Forms::Button());
			this->axWindowsMediaPlayer1 = (gcnew AxWMPLib::AxWindowsMediaPlayer());
			this->panel1->SuspendLayout();
			this->tabControl1->SuspendLayout();
			this->tabPage1->SuspendLayout();
			this->tabPage2->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->axWindowsMediaPlayer1))->BeginInit();
			this->SuspendLayout();
			// 
			// panel1
			// 
			this->panel1->BackColor = System::Drawing::Color::White;
			this->panel1->BackgroundImage = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"panel1.BackgroundImage")));
			this->panel1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
			this->panel1->Controls->Add(this->label1);
			this->panel1->Controls->Add(this->button1);
			this->panel1->Controls->Add(this->button2);
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
			this->panel1->Location = System::Drawing::Point(0, 0);
			this->panel1->Name = L"panel1";
			this->panel1->Size = System::Drawing::Size(555, 107);
			this->panel1->TabIndex = 1;
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->BackColor = System::Drawing::Color::Transparent;
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 22, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(0)));
			this->label1->ForeColor = System::Drawing::SystemColors::ActiveCaption;
			this->label1->Location = System::Drawing::Point(245, 0);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(186, 36);
			this->label1->TabIndex = 3;
			this->label1->Text = L"Music Player";
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(442, 3);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(21, 38);
			this->button1->TabIndex = 1;
			this->button1->Text = L"_";
			this->button1->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
			this->button1->UseVisualStyleBackColor = true;
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(469, 3);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(22, 38);
			this->button2->TabIndex = 2;
			this->button2->Text = L"X";
			this->button2->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
			this->button2->UseVisualStyleBackColor = true;
			// 
			// tabControl1
			// 
			this->tabControl1->Controls->Add(this->tabPage1);
			this->tabControl1->Controls->Add(this->tabPage2);
			this->tabControl1->Location = System::Drawing::Point(10, 161);
			this->tabControl1->Name = L"tabControl1";
			this->tabControl1->SelectedIndex = 0;
			this->tabControl1->Size = System::Drawing::Size(533, 199);
			this->tabControl1->TabIndex = 14;
			// 
			// tabPage1
			// 
			this->tabPage1->Controls->Add(this->listBox1);
			this->tabPage1->Location = System::Drawing::Point(4, 22);
			this->tabPage1->Name = L"tabPage1";
			this->tabPage1->Padding = System::Windows::Forms::Padding(3);
			this->tabPage1->Size = System::Drawing::Size(525, 173);
			this->tabPage1->TabIndex = 0;
			this->tabPage1->Text = L"Library";
			this->tabPage1->UseVisualStyleBackColor = true;
			// 
			// listBox1
			// 
			this->listBox1->FormattingEnabled = true;
			this->listBox1->Location = System::Drawing::Point(3, 3);
			this->listBox1->Name = L"listBox1";
			this->listBox1->Size = System::Drawing::Size(526, 212);
			this->listBox1->TabIndex = 0;
			// 
			// tabPage2
			// 
			this->tabPage2->Controls->Add(this->axWindowsMediaPlayer1);
			this->tabPage2->Location = System::Drawing::Point(4, 22);
			this->tabPage2->Name = L"tabPage2";
			this->tabPage2->Padding = System::Windows::Forms::Padding(3);
			this->tabPage2->Size = System::Drawing::Size(525, 173);
			this->tabPage2->TabIndex = 1;
			this->tabPage2->Text = L"Visualisation";
			this->tabPage2->UseVisualStyleBackColor = true;
			// 
			// button8
			// 
			this->button8->Location = System::Drawing::Point(437, 113);
			this->button8->Name = L"button8";
			this->button8->Size = System::Drawing::Size(75, 23);
			this->button8->TabIndex = 13;
			this->button8->Text = L"Import";
			this->button8->UseVisualStyleBackColor = true;
			// 
			// openFileDialog1
			// 
			this->openFileDialog1->FileName = L"openFileDialog1";
			this->openFileDialog1->Filter = L"Wav Music|*.wav";
			// 
			// button7
			// 
			this->button7->Location = System::Drawing::Point(356, 113);
			this->button7->Name = L"button7";
			this->button7->Size = System::Drawing::Size(75, 23);
			this->button7->TabIndex = 12;
			this->button7->Text = L"Previous";
			this->button7->UseVisualStyleBackColor = true;
			// 
			// button6
			// 
			this->button6->Location = System::Drawing::Point(275, 113);
			this->button6->Name = L"button6";
			this->button6->Size = System::Drawing::Size(75, 23);
			this->button6->TabIndex = 11;
			this->button6->Text = L"Next";
			this->button6->UseVisualStyleBackColor = true;
			// 
			// button5
			// 
			this->button5->Location = System::Drawing::Point(194, 113);
			this->button5->Name = L"button5";
			this->button5->Size = System::Drawing::Size(75, 23);
			this->button5->TabIndex = 10;
			this->button5->Text = L"Stop";
			this->button5->UseVisualStyleBackColor = true;
			// 
			// button4
			// 
			this->button4->Location = System::Drawing::Point(114, 113);
			this->button4->Name = L"button4";
			this->button4->Size = System::Drawing::Size(75, 23);
			this->button4->TabIndex = 9;
			this->button4->Text = L"Pause";
			this->button4->UseVisualStyleBackColor = true;
			// 
			// button3
			// 
			this->button3->Location = System::Drawing::Point(33, 113);
			this->button3->Name = L"button3";
			this->button3->Size = System::Drawing::Size(75, 23);
			this->button3->TabIndex = 8;
			this->button3->Text = L"Play";
			this->button3->UseVisualStyleBackColor = true;
			// 
			// axWindowsMediaPlayer1
			// 
			this->axWindowsMediaPlayer1->Enabled = true;
			this->axWindowsMediaPlayer1->Location = System::Drawing::Point(-4, 3);
			this->axWindowsMediaPlayer1->Name = L"axWindowsMediaPlayer1";
			this->axWindowsMediaPlayer1->OcxState = (cli::safe_cast<System::Windows::Forms::AxHost::State^  >(resources->GetObject(L"axWindowsMediaPlayer1.OcxState")));
			this->axWindowsMediaPlayer1->Size = System::Drawing::Size(533, 202);
			this->axWindowsMediaPlayer1->TabIndex = 0;
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(555, 366);
			this->Controls->Add(this->tabControl1);
			this->Controls->Add(this->button8);
			this->Controls->Add(this->button7);
			this->Controls->Add(this->button6);
			this->Controls->Add(this->button5);
			this->Controls->Add(this->button4);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->panel1);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->panel1->ResumeLayout(false);
			this->panel1->PerformLayout();
			this->tabControl1->ResumeLayout(false);
			this->tabPage1->ResumeLayout(false);
			this->tabPage2->ResumeLayout(false);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->axWindowsMediaPlayer1))->EndInit();
			this->ResumeLayout(false);

		}
#pragma endregion
	};
}



public ref class Form1
{

private:
	int XP;
	int YP;
	System::Drawing::Point NewPoint;

	void Panel1_MouseDown(Object ^sender, System::Windows::Forms::MouseEventArgs ^e)
	{

	Handles panel1::MouseDown XP = MousePosition.X - this->Location.X YP == MousePosition.Y - this->Location.Y;

}

	void Panel1_MouseMove(Object ^sender, System::Windows::Forms::MouseEventArgs ^e)
	{

Handles Panel1::MouseMove;

	if (e->Button == MouseButtons::Left)
	{
		NewPoint = MousePosition NewPoint.X == NewPoint.X - XP NewPoint.Y == NewPoint.Y - YP this->Location == NewPoint;
	}

}


	void Button1_Click(Object ^sender, System::EventArgs ^e)
	{

	Handles Button1.Click this->Close();

End Sub Sub Button2_Click(ByVal sender As System::Object, ByVal e As System::EventArgs);

	Handles Button2.Click this->WindowState = FormWindowState::Minimized;

}

	void Button8_Click(Object ^sender, System::EventArgs ^e)
	{

	Handles Button8::Click OpenFileDialog1->ShowDialog();

}

	void OpenFileDialog1_FileOk(Object ^sender, System::ComponentModel::CancelEventArgs ^e)
	{

	Handles OpenFileDialog1::FileOk;

	for each (String ^track in OpenFileDialog1::FileNames ListBox1::Items->Add(track) Next)
	{

}

Object ^Sub;

	Button3_Click(ByVal sender As System::Object, ByVal e As System::EventArgs);

	Handles Button3.Click AxWindowsMediaPlayer1->URL = ListBox1::SelectedItem;

}

	void Button5_Click(Object ^sender, System::EventArgs ^e)
	{

	Handles Button5::Click AxWindowsMediaPlayer1::Ctlcontrols::stop();

}

	void Button4_Click(Object ^sender, System::EventArgs ^e)
	{

	AxWindowsMediaPlayer1::Ctlcontrols::pause(­);

}

	void Button6_Click(Object ^sender, System::EventArgs ^e)
	{

	Handles Button6::Click AxWindowsMediaPlayer1::Ctlcontrols::next();

}

	void Button7_Click(Object ^sender, System::EventArgs ^e)
	{

	Handles Button7::Click AxWindowsMediaPlayer1::Ctlcontrols::previo­us();

}


private:
	bool initialized;
	void InitializeInstanceFields()
	{
		if ( ! initialized)
		{
			NewPoint = System::Drawing::Point();

			initialized = true;
		}
	}

public:
	Form1()
	{
		InitializeInstanceFields();
	}
};
Handles panel1::MouseDown XP = MousePosition.X - this->Location.X YP == MousePosition.Y - this->Location.Y;

What are you trying to do with this line? It doesn't make much sense to me.

Button3_Click(ByVal sender As System::Object, ByVal e As System::EventArgs);

This looks a lot like VB.NET to me. The languages can interop on an assembly level, but you can't just intersperse the source like this.

Well I would like to make it work with c++,

Can anyone help me with a few steps?

I have been given a reference but it makes no sence to me.

Which reference is it? The hangup here is that you're doing WinForms, which uses a different dialect of C++/CLI. From what I've heard, the best book for learning that is Ivar Horton's (which covers standard C++, C++/CLI WinForms, and MFC). If your reference is teaching Win32, you'll need to change your project type.

Once you decide which of those directions you want to go, someone can point you in the direction of more specific tutorials.

I will post the reference code and you might be able to tell me the type of c++ im dealing with?

The code below is what I am trying to achieve with out copying (given to my year group at university)

#pragma once

// Tian: insert headers for other forms or classes
#include "addMusicTrack_Form.h"
#include "editMusicTrack_Form.h"

namespace addMusicTrack {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace System::IO;
	
	// Tian: additional namespace to support playing sound
	using namespace System::Media;

	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	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;
	private: System::Windows::Forms::ListView^  listView1;
	private: System::Windows::Forms::ColumnHeader^  columnHeader1;
	private: System::Windows::Forms::ColumnHeader^  columnHeader2;
	private: System::Windows::Forms::Button^  button2;
	private: System::Windows::Forms::Button^  button3;
	private: System::Windows::Forms::Button^  button4;





	protected: 

	private:
		/// <summary>
		/// Required designer variable.

		// Tian: add your self-defined attributes here
		ListViewItem^ trackToEdit;

	private: System::Windows::Forms::Button^  playBtn;
	private: System::Windows::Forms::ColumnHeader^  columnHeader3;

		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->listView1 = (gcnew System::Windows::Forms::ListView());
			this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
			this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
			this->columnHeader3 = (gcnew System::Windows::Forms::ColumnHeader());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->button3 = (gcnew System::Windows::Forms::Button());
			this->button4 = (gcnew System::Windows::Forms::Button());
			this->playBtn = (gcnew System::Windows::Forms::Button());
			this->SuspendLayout();
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(333, 12);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(252, 32);
			this->button1->TabIndex = 0;
			this->button1->Text = L"Add Track";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
			// 
			// listView1
			// 
			this->listView1->CheckBoxes = true;
			this->listView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(3) {this->columnHeader1, this->columnHeader2, 
				this->columnHeader3});
			this->listView1->GridLines = true;
			this->listView1->Location = System::Drawing::Point(45, 171);
			this->listView1->Name = L"listView1";
			this->listView1->Size = System::Drawing::Size(846, 182);
			this->listView1->TabIndex = 1;
			this->listView1->UseCompatibleStateImageBehavior = false;
			this->listView1->View = System::Windows::Forms::View::Details;
			// 
			// columnHeader1
			// 
			this->columnHeader1->Text = L"Artist";
			this->columnHeader1->Width = 101;
			// 
			// columnHeader2
			// 
			this->columnHeader2->Text = L"Title";
			this->columnHeader2->Width = 144;
			// 
			// columnHeader3
			// 
			this->columnHeader3->Text = L"Music File";
			this->columnHeader3->Width = 569;
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(247, 73);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(417, 32);
			this->button2->TabIndex = 2;
			this->button2->Text = L"Save Tracks  to Database";
			this->button2->UseVisualStyleBackColor = true;
			this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
			// 
			// button3
			// 
			this->button3->Location = System::Drawing::Point(96, 123);
			this->button3->Name = L"button3";
			this->button3->Size = System::Drawing::Size(166, 31);
			this->button3->TabIndex = 3;
			this->button3->Text = L"Edit Track";
			this->button3->UseVisualStyleBackColor = true;
			this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
			// 
			// button4
			// 
			this->button4->Location = System::Drawing::Point(369, 123);
			this->button4->Name = L"button4";
			this->button4->Size = System::Drawing::Size(179, 31);
			this->button4->TabIndex = 4;
			this->button4->Text = L"Delete Track";
			this->button4->UseVisualStyleBackColor = true;
			this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
			// 
			// playBtn
			// 
			this->playBtn->Location = System::Drawing::Point(654, 123);
			this->playBtn->Name = L"playBtn";
			this->playBtn->Size = System::Drawing::Size(184, 31);
			this->playBtn->TabIndex = 5;
			this->playBtn->Text = L"Play Track";
			this->playBtn->UseVisualStyleBackColor = true;
			this->playBtn->Click += gcnew System::EventHandler(this, &Form1::playBtn_Click);
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(942, 399);
			this->Controls->Add(this->playBtn);
			this->Controls->Add(this->button4);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->listView1);
			this->Controls->Add(this->button1);
			this->Name = L"Form1";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
			this->Text = L"Manage Music Tracks";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) 
			 {
				 // Tian: open and parse the file while the form is being loaded
				 // pls. note that you need double '\' for the path
				 // you need to edit the path accordingly when compiling in your PC
				String^ fileToRead = "D:\\teaching\\aa-MusicAudio\\test\\musicTrackFile.txt";
				StreamReader^ objReader = gcnew StreamReader(fileToRead);

				// Tian: split the tracks in the tracks into substring using delimiters ','
				array<Char>^chars = {','};
				IEnumerator^ myEnum;
				String^ line;
				array<String^>^ split;
				ListViewItem^ item;

				while (!objReader->EndOfStream)
				{
					line = objReader->ReadLine();
					split = line->Split( chars );
					myEnum = split->GetEnumerator();
					while ( myEnum->MoveNext() )
					{
						// fill the first column
						String^ text = safe_cast<String^>(myEnum->Current)->Trim();
						if (text == "") break;

						item = gcnew ListViewItem(text);
					
						// fill the second and third column (subItem)
						for (int j=0; j<2; j++) 
						{
							if (myEnum->MoveNext())
							{
								text = safe_cast<String^>(myEnum->Current)->Trim();
								item->SubItems->Add(text);
							}
						}

						// add to the listView
						this->listView1->Items->Add(item);
					}
				}

				// close the file
				objReader->Close();
			}

	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				 addMusicTrack_Form ^ amtf = gcnew addMusicTrack_Form();

				 // do nothing when the cancel button or 'Esc' is clicked
				 if (amtf->ShowDialog() == ::DialogResult::Cancel) return;
				
				 // retrieve the new track info
				 array<String^>^ info = amtf->getNewTrackInfo();
				 if (info[0] == "") return;
				 
				 // add the new track into the listView
				 ListViewItem^ item = gcnew ListViewItem(info[0]);
				 item->SubItems->Add(info[1]);
				 item->SubItems->Add(info[2]);
				 this->listView1->Items->Add(item);
			 }

	private: System::Void listView1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 }

	private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e)
			 {
				 // Tian: full name and path of the file to be updated/overwritten
				String^ fileToUpdate = "D:\\teaching\\aa-MusicAudio\\test\\musicTrackFile.txt";

				// If the file exists and append is false, the file is overwritten.
				 // If the file exists and append is true, the data is appended to the file. Otherwise, a new file is created. 
				StreamWriter^ objWriter = gcnew StreamWriter(fileToUpdate, false);

				for(int i=0; i < this->listView1->Items->Count; i++)
					objWriter->WriteLine(this->listView1->Items[i]->Text + ", "
													+ this->listView1->Items[i]->SubItems[1]->Text + ", "
													+ this->listView1->Items[i]->SubItems[2]->Text);

				// close the writer and write all data into the file
				objWriter->Close();

				// show info to the user
				MessageBox::Show("The track info has been saved into the file.");
 			 }

private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e)
		 {
			 // Tian: for this example, I restrict the selection of one item only. You can make it more flexible
		 	 if(this->listView1->CheckedItems->Count != 1) {
				 MessageBox::Show("Please check one of times from the list below!");
				 return;
			 }

			 trackToEdit = this->listView1->CheckedItems[0];

			 // open the dialog to edit the selected track
			 editMusicTrack_Form^ emtf = gcnew editMusicTrack_Form();

			 // pass the information of the item checked to the form for editing purpose
			 emtf->setTrackToEdit(trackToEdit);
			 
			 // do nothing when the cancel button or 'Esc' is clicked
			 if (emtf->ShowDialog() == ::DialogResult::Cancel) return;
				
			 // retrieve the new track info and update the item
			 this->listView1->Update();
		 }

private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e)
		 {
			  // Tian: make sure at least one item is selected by the user
			  if(this->listView1->CheckedItems->Count == 0) {
				 MessageBox::Show("Please check tracks you want to delete!");
				 return;
			 }

			  // remove the checked items
			  for (int i=0; i<this->listView1->CheckedItems->Count; i++)
				  this->listView1->Items->Remove(this->listView1->CheckedItems[i]);
		 }

private: System::Void playBtn_Click(System::Object^  sender, System::EventArgs^  e) {

			
			 // Tian: for this example, I restrict the selection and playing of one track only. You can make it more flexible
		 	 if(this->listView1->CheckedItems->Count != 1) {
				 MessageBox::Show("Please check one of tracks from the list below to play!");
				 return;
			
			 //axWindowsMediaPlayer1->Ctlcontrols->next();
			 int random;
				Random^ rand;
				rand = gcnew Random();
				int count = axWindowsMediaPlayer1->mediaCollection->getAll()->count;
				random = rand->Next(count);
				axWindowsMediaPlayer1->currentMedia = axWindowsMediaPlayer1->mediaCollection->getAll()->Item[random];
				axWindowsMediaPlayer1->Ctlcontrols->play();
		 }
			 }

			 // the actual music file and its path is kept in the second subItem (of each track)
			 String^ filePath = this->listView1->CheckedItems[0]->SubItems[2]->Text;

			 // using soundplayer class to play the sound
			 // note that it can play .wav sound only, and this .wav file must be in PCM (pulse-code modulation) or exception will occur
			 // for this assignment, you may want to choose some of .wav music track to demonstrate 
			SoundPlayer^ player = gcnew SoundPlayer();
			player->SoundLocation = filePath;
			player->Play();

		 }
};
}

That's C++/CLI see http://www.functionx.com/vccli/index.htm for a good tutorial about it. Learn to use the UI designer and determine how to use it to place the event handlers into your code (for example double clicking on button3 will place a button3_click method into your code, just a skeleton, though). Use VC++ 2008 if you can because it has much better Intellisense for C++/CLI (the one in 2010 is virtually nonexistent for this dialect).

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.