程序又出问题了,不知怎么了

 

// CityZoneDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Ex_CityCode2.h"
#include "CityZoneDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/
// CCityZoneDlg dialog


CCityZoneDlg::CCityZoneDlg(CWnd* pParent /*=NULL*/)
 : CDialog(CCityZoneDlg::IDD, pParent)
{
 //{{AFX_DATA_INIT(CCityZoneDlg)
  // NOTE: the ClassWizard will add member initialization here
 //}}AFX_DATA_INIT
}


void CCityZoneDlg::DoDataExchange(CDataExchange* pDX)
{
 CDialog::DoDataExchange(pDX);
 //{{AFX_DATA_MAP(CCityZoneDlg)
  // NOTE: the ClassWizard will add DDX and DDV calls here
 //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCityZoneDlg, CDialog)
 //{{AFX_MSG_MAP(CCityZoneDlg)
 ON_BN_CLICKED(IDC_BUTTON_ADD, OnButtonAdd)
 ON_BN_CLICKED(IDC_BUTTON_CHANGE, OnButtonChange)
 ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
 ON_WM_DESTROY()
 //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/
// CCityZoneDlg message handlers

BOOL CCityZoneDlg::IsValidate()
{
UpdateData();
m_strCity.TrimLeft();
if(m_strCity.IsEmpty())
{MessageBox("城市名输入无效!");return FALSE;
}
m_strZip.TrimLeft();
if(m_strZip.Isvalidate())
{MessageBox("邮政编码输入无效!");return FALSE;
}
m_strZone.TrimLeft();
if(m_strZone.Isvalidate())
{MessageBox("区号输入无效!");return FALSE;
}
return TRUE;
}

void CCityZoneDlg::OnButtonAdd()
{
 // TODO: Add your control notification handler code here
if(!Isvalidate()) return;
int nIndex=m_ComboBox.FindStringExact(-1,m_strCity);
if(nIndex!=CB_ERR)
{MessageBox("该城市已添加!");return;}
CString strData;
strData.Format("%s,%s",m_strZip,m_strZone);
m_ComboBox.SetItemDataPtr(nIndex,new CString(strData));
}

void CCityZoneDlg::OnButtonChange()
{
 // TODO: Add your control notification handler code here
if(!Isvalidate()) return;
int nIndex=m_ComboBox.FindStringExact(-1,m_strCity);
if(nIndex!=CB_ERR) 
{delete(CString*)m_ComboBox.GetItemDataPtr(nIndex);
 CString strData;
strData.Format("%s,%s",m_strZip,m_strZone);
m_ComboBox.SetItemDataPtr(nIndex,new CString(strData));
}

void CCityZoneDlg::OnSelchangeCombo1()
{
 // TODO: Add your control notification handler code here
int nIndex=m_ComboBox.GetCurSel();
if(nIndex!=CB_ERR)
{m_ComboBox.GetLBText(nIndex,m_strCity);
CString strData=*(CString*)m_ComboBox.GetItemDataPtr(nIndex);
int n=strData.Find(',');
m_strZip=strData.Left(n);
m_strZone=strData.Mid(n+1);
UpdateData(FALSE);

}

void CCityZoneDlg::OnDestroy()
{
 CDialog::OnDestroy();
 
 // TODO: Add your message handler code here
for(int nIndex=m_ComboBox.GetCount()-1;nIndex>=0;nIndex)
delete(CString*)m_ComboBox.GetItemDataPtr(nIndex);

}

-------------------Configuration: Ex_CityCode2 - Win32 Debug--------------------
Compiling...
CityZoneDlg.cpp
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(51) : error C2065: 'm_strCity' : undeclared identifier
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(51) : error C2228: left of '.TrimLeft' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(52) : error C2228: left of '.IsEmpty' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(55) : error C2065: 'm_strZip' : undeclared identifier
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(55) : error C2228: left of '.TrimLeft' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(56) : error C2228: left of '.Isvalidate' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(59) : error C2065: 'm_strZone' : undeclared identifier
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(59) : error C2228: left of '.TrimLeft' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(60) : error C2228: left of '.Isvalidate' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(70) : error C2065: 'm_ComboBox' : undeclared identifier
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(70) : error C2228: left of '.FindStringExact' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(75) : error C2228: left of '.SetItemDataPtr' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(82) : error C2228: left of '.FindStringExact' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(84) : error C2228: left of '.GetItemDataPtr' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(87) : error C2228: left of '.SetItemDataPtr' must have class/struct/union type
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(91) : error C2601: 'OnSelchangeCombo1' : local function definitions are illegal
D:\新建文件夹\Ex_CityCode2\CityZoneDlg.cpp(105) : error C2601: 'OnDestroy' : local function definitions are illegal
执行 cl.exe 时出错.
I'm new,what's the matter with it? look for help........

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值