<pre>#pragma once #include <thread> using namespace std; namespace Project1 { 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 MyForm /// </summary> public ref class MyForm : public System::Windows::Forms::Form { public: MyForm(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~MyForm() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::ListBox^ listBox1; protected: 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) { this->button1 = (gcnew System::Windows::Forms::Button()); this->listBox1 = (gcnew System::Windows::Forms::ListBox()); this->SuspendLayout(); // // button1 // this->button1->Location = System::Drawing::Point(33, 51); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(75, 23); this->button1->TabIndex = 0; this->button1->Text = L"button1"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click); // // listBox1 // this->listBox1->FormattingEnabled = true; this->listBox1->Location = System::Drawing::Point(279, 29); this->listBox1->Name = L"listBox1"; this->listBox1->Size = System::Drawing::Size(155, 225); this->listBox1->TabIndex = 1; this->listBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &MyForm::listBox1_SelectedIndexChanged); // // MyForm // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(542, 348); this->Controls->Add(this->listBox1); this->Controls->Add(this->button1); this->Name = L"MyForm"; this->Text = L"MyForm"; this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load); this->ResumeLayout(false); } /////I WANT TO MAKE THREAD FOR THIS FUNCTION AND MORE ///// int testfun(int o , int lol) { for (int i = o; i < lol; i++) { listBox1->Items->Add(i); return 0; } } #pragma endregion private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { /////BUT THIS CODE HERE IS NOT WORKING :::: ///// // LOT OF PROBLEMS : //1-std::array': too few template arguments //2-'^': cannot use this indirection on type 'std::array' //3-no instance of constructor "std::thread::thread" matches the argument //list //4-too few arguments for class template "std::array" ////// std::thread porsst(testfun, 1, 5); porsst.join(); } private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) { } private: System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { } }; }
// LOT OF PROBLEMS : //1-std::array': too few template arguments //2-'^': cannot use this indirection on type 'std::array' //3-no instance of constructor "std::thread::thread" matches the argument //list //4-too few arguments for class template "std::array"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)