1. private: System::Void btnAdd_Click(System::Object^ sender, System::EventArgs^ e) {
  2.  
  3.  
  4.  
  5. const char *Temp = (const char*)(Marshal::StringToHGlobalAnsi(txtDescription->Text)).ToPointer();
  6. P[Count].Description = Temp;
  7.  
  8.  
  9. P[Count].count = int::Parse(txtCount->Text);
  10.  
  11. String ^strExpiryDate = dateTimePicker->Value.ToShortDateString();
  12.  
  13. const char *Tmp2 = (const char*) (Marshal::StringToHGlobalAnsi(strExpiryDate)).ToPointer();
  14.  
  15. P[Count].expiry = Tmp2;
  16.  
  17.  
  18. P[Count].price = double::Parse(txtPrice->Text);
  19.  
  20.  
  21.  
  22. MessageBox::Show("Item has been successfully added to the list.", "Item Saved", MessageBoxButtons::OK, MessageBoxIcon::Information);
  23.  
  24. Count++;
  25.  
  26.  
  27. }