编写了一个人事管理系统,查询功能 弹出对话框,输入编号,根据编号在主模块的对话框中显示数据,我是这样实现的
void selectdialog::OnOK1() 
{
// TODO: Add your control notification handler code here
UpdateData(true);
for(int i=0;i<length;i++)
{
if(employer[i].GetEmpID()==m_snumber)
{
       m_edit4=employer[i].GetEmpID();
       m_edit1=employer[i].GetEmpName();
   m_edit5=employer[i].GetEclass();
   m_edit2=employer[i].GetEmpSex();
   m_edit8=employer[i].GetMarryState();
   m_edit3=employer[i].GetEmpBirth();
   m_edit5=employer[i].GetState();
       m_edit7=employer[i].Getepay();}
}
UpdateData(false);
}
m_editx是指XXXView.h中的编辑框,想让他显示出来 可是无法显示 怎么回事?

解决方案 »

  1.   

    (XXXView*)AfxGetApp()->
    如果是主窗口的话 (XXXView*)AfxGetMainWnd()->
      

  2.   

    给你的例子:
    假设你有2个类:A和B
    A类就是对话框,得到输入的编号,在A类中定义一个变量:
        public:  
                cstring strA;在B类中定义一个A类的成员变量:
    B.h
    public:
            A a;
           cstring strB;B.cpp:
          strB = a.strA;
    strB就是你要的值
    你的要求跟这个类似,就是定义类成员变量。