473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Document Class pointer error

Hi,

I am using embedde visual C++ and I have create a dialog box and a button call ID_BInsert.

Below is the code for button ID_BInsert:
-------------------------------------------------------------------------------------

void CNEWSERIALNO::OnBInsert()
{
// TODO: Add your control notification handler code here

CTokenEx tok;
CStringArray arr_SerialNo;

UpdateData (TRUE);
CString sSerialNo(m_sSerialNo);

tok.Split(sSerialNo, "\r\n", arr_SerialNo, FALSE);

CMobileInventoryDoc* pDoc = GetDocument();

for (int i =0; i < arr_SerialNo.GetSize(); i++)
{
AfxMessageBox(arr_SerialNo[i], MB_OK);

if (pDoc)
{
// Get the last record from the document
m_pCurItem = pDoc->GetLastRecord();
if (m_pCurItem)
{
m_pCurItem = pDoc->GetNextRecord();
if (m_pCurItem)
m_pCurItem->SetSerialNo(arr_SerialNo[i]);
}
}
}
}

-------------------------------------------------------------------------------------

When I compile and build the application, it give me the error as below:

C:\Documents and Settings\user1\My Documents\MobileInventory\NEWSERIALNO.cpp(61) : error C2065: 'GetDocument' : undeclared identifier
C:\Documents and Settings\user1\My Documents\MobileInventory\NEWSERIALNO.cpp(61) : error C2440: 'initializing' : cannot convert from 'int' to 'class CMobileInventoryDoc *'

The statement that cause the error is statement below:
CMobileInventoryDoc* pDoc = GetDocument();

But I have use this statement in view class and it is no problem.

May someone tell me what is the problem and how to solve it.

Thanks in advance.

Best Regards.
May 3 '06 #1
2 2285
Banfa
9,065 Expert Mod 8TB
GetDocument is a member of the view class which is why you can use it from there. You are coing to need to know the document or view class already from with-in this class even if it means passing a reference to it into the constructor
May 3 '06 #2
Thanks for reply.

Actually what I want to do is get a pointer to current active document from dialog box.

However, I have solved the problem.

Thank you.
May 4 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
3
by: Rob F | last post by:
I am trying to compile a string class which was working before but subsequent attempts to make it more 'object orientated' (privatizing the member variables and implenting query functions) it...
11
by: Jacob | last post by:
I am trying to find the best way of documenting (in code and comments) ownership of secondary contained objects. This is my current status, and I would appreciate feedback on it: Case 1: ...
15
by: marco | last post by:
Hi, I'm a Javascript Newby. But that doesn't discourage me at all. At this time I'm working on a little javascript-gimmick. A white browser page filled with white (invissible for the viewer)...
6
by: Bill Cohagan | last post by:
I've got a c# app that does some transforms using XSL files that are stored as Embedded Resources in the app. That turns out to be significant; i.e., the problem I've encountered goes away if I...
6
by: Itay_k | last post by:
Hello, I want a member in my class that will save pointer to pointer to System::Drawing::Image class. When I write on my class code: System::Drawing::Image **bmp; I get this error message:...
2
by: Jessica | last post by:
I have a base class and a derived class, but I am getting errors when I try to access functions of the derived class. Simplified version of my code is as follows: //////////////// // test2.hh...
5
by: Amit_Basnak | last post by:
Dear Friends I have been getting the following error Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a pointer to class; type found was 'struct WF_SEARCH_WU'....
5
by: ankit1999 | last post by:
I have a problem, everytime i'm run this page http://click2travel.in/index.php i get the this error,,,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.