Click here to Skip to main content
15,794,202 members

Comments by 2buck56 (Top 9 by date)

2buck56 22-Nov-10 15:51pm View    
Richard, I thought I had tried *ar << but I must not have because that does work. This was just a learning experience as I don't think there is any real advantage to using *ar versus using ar and br for store and load operations. But it does give me knowledge for future use. Thanks for all your help.
2buck56 22-Nov-10 14:56pm View    
Hmmm..... This code:
CArchive* ar = new CArchive(&f, CArchive::store);
for(x=0; x<7; x++)
numarray[x][0] = m_ListCtrl.GetItemText(x,0);
ar << numarray[x][0];
numarray[x][1] = m_ListCtrl.GetItemText(x,1);
ar << numarray[x][1];
The compiler gives this error:
error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'CArchive *' (or there is no acceptable conversion)
2buck56 22-Nov-10 12:37pm View    
Richard, thanks for the suggestion. However, I've tried using CArchive* ar with new and delete. Even after you delete the ar pointer, you cannot re-use it. The compiler complains with the same error message. If I am going to have to create 2 objects anyway, I might as well use ar for writing and br for reading.
2buck56 8-Nov-10 15:38pm View    
_Superman, thanks for all your help. That works perfectly now. The class constructor and private member variable in CEditData did the job. For calling from the CSmartBlockDlg class into the CEditData class I stayed with creating another instance of CEditData.

The next time I need to do this I will have this project for a reference. The Dialog based class created problems for me.
2buck56 8-Nov-10 13:10pm View    
Can you show me a couple of code snippets on how to get the addresss of the Dialog box and pass it to the other function? I did this: CWnd *pWnd = GetDlgItem(IDD_SMARTBLOCK_DIALOG); and passed pWnd to the other function.

I changed the other function to this: void CEditData::CheckData(int DataType, CWnd *myData) but in the CheckData function when i use myData-> the CAddList is not available.

When I call the CEditData function from the CDialog class I will create another object for that. Since I will only be doing some math over there it doesn't matter if it is done with the original class or another instance.

I'm starting to get to the point I'm seriously considering forgetting about the other class and just have my original Dialog class do everything. I was trying to avoid 1500 lines of code in one class but there may not be a way to do that.