private: System::Void btnAdd_Click(System::Object^ sender, System::EventArgs^ e) { const char *Temp = (const char*)(Marshal::StringToHGlobalAnsi(txtDescription->Text)).ToPointer(); P[Count].Description = Temp; P[Count].count = int::Parse(txtCount->Text); String ^strExpiryDate = dateTimePicker->Value.ToShortDateString(); const char *Tmp2 = (const char*) (Marshal::StringToHGlobalAnsi(strExpiryDate)).ToPointer(); P[Count].expiry = Tmp2; P[Count].price = double::Parse(txtPrice->Text); MessageBox::Show("Item has been successfully added to the list.", "Item Saved", MessageBoxButtons::OK, MessageBoxIcon::Information); Count++; }