I am trying to write a program that uses a global vector of a struct in a c++ windows form. Below is the code. The commented areas are attempts I've made to create a vector. Most of them do not compile. Some of them compile, but the program will not display. I do not understand the nature of this error because I was able to create vectors of structs in command line programs. Any help would be appreciated!
#pragma once
#include <vector>
#include <cliext/vector>
namespace student_database {
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 Form11
/// </summary>
public ref class Form11 : public System::Windows::Forms::Form
{
public:
Form11(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form11()
{
if (components)
{
delete components;
}
}
private:
ref struct student{
int index;
String^ name;
cliext::vector <String^> essays;
};
cliext::vector <student^> student_vector; // builds without errors, but program does not start
// array <student^>^ Qarray;
// static cliext::vector<student^>::generic_container^ student_vector = gcnew cliext::vector<student^>;//(0);
// cliext::vector<student^> ^c;
// c = gcnew(cliext::vector<student^>);
//cliext::vector <student> student_vector = gcnew cliext::vector <student>;
//cliext::vector<student^> ^student_vector = gcnew(cliext::vector<student^>);
// cliext::vector <student^>^ student_vector;
// Microsoft::VisualC::StlClr::Ivector<student^> ^student_vector;
// Ivector<student^> ^student_vector;
/// <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->SuspendLayout();
//
// Form11
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->Name = L"Form11";
this->Text = L"Form11";
this->Load += gcnew System::EventHandler(this, &Form11::Form11_Load);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void Form11_Load(System::Object^ sender, System::EventArgs^ e) {
}
};
}