Editing item programmatically

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.


Normally an edit is initiated when a user clicks on an
item that already has the focus. Suppose, you want to start the edit when
the user clicks a button, here is the code to start the edit.

m_listctrl.SetFocus();
m_listctrl.EditLabel(nItem);

You should remember to SetFocus() if the listview control does not already
have the focus. Of course, for this to work, the listview control should
have the LVM_EDITLABEL style.

 

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read