You have to add corresponding columns to your list control which must be in report mode (
LVS_REPORT
style, usually defined in the resource file). Do this within the initialisation function of the parent window (e.g.
OnInitDialog
with dialog windows):
m_lstStudent.InsertColumn(0, _T("Name"));
m_lstStudent.InsertColumn(1, _T("ID"));
m_lstStudent.InsertColumn(2, _T("Class"));
Then set the column data after adding a new item:
int pos = m_lstStudent.InsertItem(0, sname);
m_lstStudent.SetItemText(pos, 1, id);
m_lstStudent.SetItemText(pos, 2, sclass);