How can I get the current text from a combobox whenever the user selected a new item in a combobox?

If you are using CGXComboBox, you should override OnModifyCell and call pControl->GetValue to get the current text of the cell.

Example:

void CGXWndEx::OnModifyCell(ROWCOL nRow, ROWCOL nCol)
{
   CGXGridWnd::OnModifyCell(nRow, nCol);
   CGXControl* pControl = GetControl(nRow, nCol);
   pControl->GetValue(strValue);
   TRACE("OnModifyCell %s\n", strValue );
}

With CGXComboBoxWnd there is a minor problem because CComboBox sends the CBN_SELCHANGE method before it updates the edit box portion of the control. Therefore pControl->GetValue returns the old value.

The following code works around that problem:

BOOL CGXWndEx::OnCommand(WPARAM wParam, LPARAM lParam)
{
#if _MFC_VER < 0x0300
   UINT nNotification = HIWORD(lParam);
   HWND hCtl = (HWND) LOWORD(lParam);
#else
   UINT nNotification = HIWORD(wParam);
   HWND hCtl = (HWND) lParam;
#endif
   if (nNotification == CBN_SELCHANGE)
   {
      CGXComboBoxWnd* pControl = (CGXComboBoxWnd*) GetCurrentCellControl();
      CString strValue;
      pControl->GetLBText(pControl->GetCurSel(), strValue);
      TRACE("Combobox changed %s\n", strValue );
   }
   BOOL bResult = CGXGridWnd::OnCommand(wParam, lParam);
   return bResult;
}