📄 finddlg1.cpp
字号:
// findDlg1.cpp : implementation file
//
#include "stdafx.h"
#include "glxt.h"
#include "findDlg1.h"
#include "gshxDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CfindDlg dialog
CfindDlg::CfindDlg(CWnd* pParent /*=NULL*/)
: CDialog(CfindDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CfindDlg)
m_getstring = _T("");
m_constr1 = _T("");
//}}AFX_DATA_INIT
}
void CfindDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CfindDlg)
DDX_CBString(pDX, IDC_COMBO1, m_getstring);
DDX_Text(pDX, IDC_EDIT1, m_constr1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CfindDlg, CDialog)
//{{AFX_MSG_MAP(CfindDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CfindDlg message handlers
BOOL CfindDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_db.Open(_T("gshDSN"));
m_set.m_pDatabase=&m_db;
// TODO: Add extra initialization here
//CgshxDlg dlg1;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CfindDlg::Onchaxun()
{
CgshxDlg dlg1;
CfindDlg dlg;
//if (dlg.DoModal()==IDOK)
UpdateData();
dlg.m_constr1.TrimRight();
if(dlg.m_getstring=="按供应商编号查询")
m_set.m_strFilter="Pno like '%" + dlg.m_constr1 + "%'";
else if(dlg.m_getstring=="按供应商名称查询")
m_set.m_strFilter="Pname like '%" + dlg.m_constr1 + "%'";
m_set.Open();
if (m_set.IsEOF())
{
MessageBox("对不起,没有您要查找的记录!","提示");
return ;
}
else
{
int n = 0 ;
while(!m_set.IsEOF())
{
m_set.m_Pno.TrimRight();
dlg1.m_listcx.InsertItem(n,m_set.m_Pno);
dlg1.m_listcx.SetItemText(n,1,m_set.m_Pname);
dlg1.m_listcx.SetItemText(n,2,m_set.m_Paddr);
dlg1.m_listcx.SetItemText(n,3,m_set.m_Pcontacter);
dlg1.m_listcx.SetItemText(n,4,m_set.m_Ptel);
dlg1.m_listcx.SetItemText(n,5,m_set.m_Pemail);
dlg1.m_set.MoveNext();
n++;
}
}
m_set.Close();
dlg1.DoModal();
}
void CfindDlg::OnButton1()
{
// TODO: Add your control notification handler code here
Onchaxun();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -