updatedlg.cpp

来自「Visual_C++[1].NET_Bible1 Visual_C++宝典书中」· C++ 代码 · 共 59 行

CPP
59
字号
// UpdateDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ADODemo.h"
#include "UpdateDlg.h"


// CUpdateDlg dialog

IMPLEMENT_DYNAMIC(CUpdateDlg, CDialog)
CUpdateDlg::CUpdateDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CUpdateDlg::IDD, pParent)
{
  m_strUserId = "";
  m_strUserName = "";
}

CUpdateDlg::~CUpdateDlg()
{
}

void CUpdateDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_strUserId);
	DDX_Text(pDX, IDC_EDIT2, m_strUserName);
}


BEGIN_MESSAGE_MAP(CUpdateDlg, CDialog)
  ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()


// CUpdateDlg message handlers

void CUpdateDlg::OnBnClickedOk()
{
  // Retrieve dialog values into DDX variables.
  if (UpdateData())
  {
    // Make sure that we have an user id and name.
    if (0 < m_strUserId.GetLength()
    &&  0 < m_strUserName.GetLength())
    {
      // If so, end dialog. Parent dialog will
      // the retrieve values.
      CDialog::OnOK();
    }
    else
    {
      // If not, tell user that we need these 
      // values in order to update the database.
      AfxMessageBox("You must specify a user name to continue");
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?