Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need CView Help

Status
Not open for further replies.

mercwrought

Programmer
Dec 2, 2004
176
US
Hi all it is question time.
If you can not guess I am not a very good programmer. But I usually can find what I need. This one has got me stumped. I have a program that has 6 views that all have the same variable recordset I need to from the main frame gain access to a member of that recordset. Here is the thought


From in the mainframe

Code:
Int x =CView->CRecordset->int;

I know it is possible but I am not sure how. thx for any help
 
>I have a program that has 6 views that all have the same variable recordset

Hmmm, then perhaps the document would be a good place to have the variable in?

> from the main frame gain access

Some hints:
1) You can access the views from the doc:
CDocument::GetFirstViewPosition / CDocument::GetNextView

2) You can access the doc from the doc template:
CDocTemplate::GetFirstDocPosition / CDocTemplate::GetNextDoc

3) You can access the doc template from the CWinApp:
CWinApp::GetFirstDocTemplatePosition / CWinApp::GetNextDocTemplate

4) You can access the app from anywhere:
AfxGetApp()


/Per

"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."
 
PerFnurt I thank you for your response. To clarify I did not write the program originally so it is not a matter of where to stick it but where they stuck it. Before I got in this morning I figured it out using AfxGetApp() but your response offers me some more insight into this whole cview system. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top