Smave
asked on
Contents of an EditBox
I have an MFC project where the main form is based on CDAORecordView.
The EditBox's ID is: IDC_EDIT_CurrentRecord
its value member variable is long m_CurrentRecord.
its control member variable is CEdit m_CurrentRecordCTRL.
As I use the record selectors in the toolbar I have use the GetAbsolutePosition function to update the m_CurrentRecord member variable.
During runtime, when I change the value of the EditBox I want the form to Move to the record number in the EditBox.
The following code compiles with no errors.
void CTheoFrontEndView::OnKillf ocusEDITCu rrentRecor d()
{
// TODO: Add your control notification handler code here
CString strTemp;
m_CurrentRecordCTRL.GetDlg ItemText(I DC_EDIT_Cu rrentRecor d, strTemp);
m_pSet->SetAbsolutePositio n(atol(str Temp));
}
The problem is the GetDlgItemText returns NULL.
Why?
also
How can I get the contents of the EditBox independant of its member variable?
or
Am I approching this problem all wrong?
Dave
The EditBox's ID is: IDC_EDIT_CurrentRecord
its value member variable is long m_CurrentRecord.
its control member variable is CEdit m_CurrentRecordCTRL.
As I use the record selectors in the toolbar I have use the GetAbsolutePosition function to update the m_CurrentRecord member variable.
During runtime, when I change the value of the EditBox I want the form to Move to the record number in the EditBox.
The following code compiles with no errors.
void CTheoFrontEndView::OnKillf
{
// TODO: Add your control notification handler code here
CString strTemp;
m_CurrentRecordCTRL.GetDlg
m_pSet->SetAbsolutePositio
}
The problem is the GetDlgItemText returns NULL.
Why?
also
How can I get the contents of the EditBox independant of its member variable?
or
Am I approching this problem all wrong?
Dave
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked perfect.
Thank you!
Thank you!
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHa
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString strHello;
strHello.LoadString(IDS_HE
cout << (LPCTSTR)strHello << endl;
//here is where I want to 'cout' the contents of the fields in
//the table
BTable* pBTbl1 = new BTable(NULL);
if(!pBTbl1->IsOpen())
pBTbl1->Open();
cout << "PrimeKey: " << pBTbl1->m_PrimeKey << endl;
cout << "Book Title: " << (LPCTSTR)pBTbl1->m_BookTit
cout << "Book Number: " << pBTbl1->m_BookNumber << endl;
cout << "Chapter: " << pBTbl1->m_Chapter << endl;
cout << "Verse: " << pBTbl1->m_Verse << endl;
cout << "English: " << (LPCTSTR)pBTbl1->m_1769_Au
cout << "Non-English: " << (LPCTSTR)pBTbl1->m_NotEngl
pBTbl1->Close();
delete pBTbl1;
}
return nRetCode;
}