Click here to Skip to main content
15,896,915 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to delete multiple rows in CGridctrl?

What I have tried:

Dont know how to loop through and delete items
Posted
Updated 27-Apr-18 3:54am

1 solution

Please read the documentation for the control in question rather than repeatedly posting these questions. And if you are saying that you do not know how to write a simple loop, then the C++ documentation is your best bet.
 
Share this answer
 
Comments
[no name] 27-Apr-18 9:56am    
Sorry. I know looping and achieved myself how to delete multiple rows through this code.
vector<unsigned int> vec;
int nFixed = m_ctrlScreensList.GetFixedRowCount();
int nCount = m_ctrlScreensList.GetRowCount()-1;

// Delete all data rows
for (int nRow = nCount; nRow >= nFixed; nRow--)
{
if (m_ctrlScreensList.IsCellSelected(nRow, 1))
vec.push_back(nRow);
}
//m_ctrlScreensList.ResetSelectedRange();
for (int i=0;i<vec.size();i++)
m_ctrlScreensList.DeleteRow(vec[i]);

m_ctrlScreensList.Invalidate();
Richard MacCutchan 27-Apr-18 10:03am    
Then why did you post this question?
[no name] 27-Apr-18 10:06am    
Once I deleted a row, the rows are getting deselected so I could not delete multiple rows thats why I posted this question.After posting this question I tried more and met my requirement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900