I am currently using Visual Studio 2008 Pro edition programming a windows form application using Visual C++.
I am using datagrids, the user can populate fields with data. I am not using datasets because the information doesn't have to remain once the app has closed. When the user selects a row and deletes it with the "Delete" key on the keyboard, I want to trigger an event. I got it to this point but now I am having a problem because I want to know the contents of the fields that were deleted. So I am trying this e->MemberwiseClon e() to get the contents of the cells and save into "row" so that I can gain access to the cells. But unfortunately I get this error:
error C3767: 'System::Object ::MemberwiseClo ne': candidate function(s) not accessible
MemberwiseClone () is under protected, so I tried the #pragma make_public but I also got an error with that, although I'm not sure if I used that correctly or not.
My ultimate goal is to find out the contents of the cells that were deleted. I don't know if I am taking the right approach but that is my goal. I am open to any suggestions and would greatly appreciate them. Thanks in advance.
I am using datagrids, the user can populate fields with data. I am not using datasets because the information doesn't have to remain once the app has closed. When the user selects a row and deletes it with the "Delete" key on the keyboard, I want to trigger an event. I got it to this point but now I am having a problem because I want to know the contents of the fields that were deleted. So I am trying this e->MemberwiseClon e() to get the contents of the cells and save into "row" so that I can gain access to the cells. But unfortunately I get this error:
error C3767: 'System::Object ::MemberwiseClo ne': candidate function(s) not accessible
MemberwiseClone () is under protected, so I tried the #pragma make_public but I also got an error with that, although I'm not sure if I used that correctly or not.
My ultimate goal is to find out the contents of the cells that were deleted. I don't know if I am taking the right approach but that is my goal. I am open to any suggestions and would greatly appreciate them. Thanks in advance.
Code:
private: System::Void dataGridView1_RowsRemoved(System::Object^ sender, System::Windows::Forms::DataGridViewRowsRemovedEventArgs^ e) { //to verify that the deletion is working correctly MessageBox::Show("row " + e->RowIndex.ToString() + " has been removed"); DataGridViewRow row = (DataGridViewRow) e->MemberwiseClone(); } }
Comment