在列表框控件里现在从表里读出了如下的数据:
    id   dID   name
     1   05001  aa
     2   05002  bb
     3   05005  cc
     4   05007  dd现在我有一个列表框,我想让添加的新值05004按照dID的大小排序插入到05002这条记录的后面,而不是插入到最后,请问我该如何做呢?

解决方案 »

  1.   

    能不能具体点啊,SortItems我不会用,那些参数不知怎么用,我这个的一些代码如下:

    m_nCurrentSel = m_listDevice.InsertItem(0xffff,"");  int countde = m_listDevice.GetItemCount();
    int cde = countde+1;
    CString strde;
    strde.Format("%d",cde);    m_listDevice.SetItem(m_nCurrentSel,0,LVIF_TEXT,(_bstr_t)strde,NULL,0,0,0);
     m_listDevice.SetItem(m_nCurrentSel,1,LVIF_TEXT,(_bstr_t)m_dID,NULL,0,0,0);
     m_listDevice.SetItem(m_nCurrentSel,2,LVIF_TEXT,(_bstr_t)m_name,NULL,0,0,0);