我把几个Edit Control控件添加了CString变量
在某成员函数中,我先把CString变量清空 xxx.Empty()
然后根据条件有些赋值了有些没赋值,之后调用UpdateData(FALSE)
可是觉得不赋值的调用该函数之后还是有内容,而不是想要的未赋值的就清空了
为什么控件

解决方案 »

  1.   

    变量清空 xxx.Empty()这个是判断用的!
      

  2.   

    CString::Empty 
    void Empty( );ResMakes this CString object an empty string and frees memory as appropriate.For more information, see n Visual C++ Programmer’s GuideExampleThe following example demonstrates the use of CString::Empty.// example for CString::Empty
    CString s( "abc" );
    s.Empty();
    ASSERT( s.GetLength( ) == 0 );
    CString Overview |  Class Members |  Hierarchy ChartSee Also   CString::IsEmpty
      

  3.   

    UpdateData(FALSE);会清空所有控件内容,最好用SetDlgItemText()
      

  4.   

    CString变量清空,直接给它赋空值就行了,如:CString str = _T("");
      

  5.   


    你在要设置编辑框值的时候直接调用这个函数多方便
    SetDlgItemText(IDC_EDIT, str); 
      

  6.   

    是否所有的 edit 关联为 CString 变量 了?