Im new programmer, learning C++ nearly 15 weeks so far and I'm doing a small project about student database with GUI ( Windows-forms ). I created GUI with Drag n Drop thing in Visual Studio 2015.
I have class Student with 13 variables including getters and setters (Index, First Name,Last name, etc...). I've successfully opened connection with MySQL database for Adding, Deleting and Update students.
And I also wrote objects String^ to pick text from my TextBoxes and then parse them into normal string with msclr/marshal.
Now, problem is when i create object of Student and after adding it into vector with code below:
vector<Student> vektor;
Student *s = new Student(iIndeks, cIme, cPrezime, cDatumRodjenja, cFakultet, cSmer, cEmail, iBrTelefona, cDrzava, cMesto, cUlicaIBroj, cOpstina, iPostanskibr);
vektor.push_back(*s);
Im unable to add elements of that vector into listBox with:
listBox1->Items->Add(vektor);
It says this error:
Function cannot be called with given argument list,
argument types are:
(std::vector<Student, std::allocator<Student>>) object type is:
System::Windows::Forms::ListBox::ObjectCollection ^.
I guess its pretty self-explaining but I have no idea (should I or not) create my class like the ref class or something like that? Any suggestion what this newbie can do?
Thanks for help.
Aucun commentaire:
Enregistrer un commentaire