Scott MacMaster
July 13th, 1999, 05:49 PM
I'm trying to write a function to remove an item from a combo box. How it works is you select a item in the drop down box and then click remove. It this point a window will come up and ask "Are you sure you want to remove this item." This item will be the text of the combo box list item to be removed. However, I can't quite get the correct text for the item. I couldn't find a function in the documentation that will get the text of the selected item so I tried to using the GetWindowText() function. That will return the text of the first item in the list. Even after it's been removed. Here is the function:
void CAddRemoveGroupDlg::OnRemove()
{
// TODO: Add your control notification handler code here
CString Text;
CString Message;
m_Group.GetWindowText(Text);
Message = "Are you sure you want to remove the group '" + Text;
Message += "'?";
if(AfxMessageBox(Message, MB_YESNO) == IDYES)
{
m_Groups.DeleteString(m_Groups.GetCurSel());
m_Groups.SetCurSel(0);
}
}
Does anyone know how to get this to work?
Scott MacMaster
______________________
http://welcome.to/scottweb
void CAddRemoveGroupDlg::OnRemove()
{
// TODO: Add your control notification handler code here
CString Text;
CString Message;
m_Group.GetWindowText(Text);
Message = "Are you sure you want to remove the group '" + Text;
Message += "'?";
if(AfxMessageBox(Message, MB_YESNO) == IDYES)
{
m_Groups.DeleteString(m_Groups.GetCurSel());
m_Groups.SetCurSel(0);
}
}
Does anyone know how to get this to work?
Scott MacMaster
______________________
http://welcome.to/scottweb