Solved

Showing a CRecordView Dialog

Posted on 1998-05-18
5
368 Views
Last Modified: 2008-02-01
Hello,
I am trying to show a Dialog constructed in the AppWizard with the base-class CRecordView. Now when I try to show the dialog, I get an assertion failure. This is done in the Dialog based application.
The way I have done this is =

CMyRecordView cView;

cView.ShowWindow(SW_SHOW);
cView.Update();

Shouldn't this be enough for showing my dialog?
Is it possible to display a CRecordView in a dialog based application?
Please help me!!!
0
Comment
Question by:Imran020598
  • 3
  • 2
5 Comments
 

Expert Comment

by:matzon
ID: 1163001
Hi....
Your problem is, that you try to show a window which hasn't yet been created!

You have to instanciate it and then call its create command...
i.e.
//In you Header file
CMyRecordView cView;

//In your cpp file
cView.Create(YOUR_RESOURCE_ID, &TheParent);
//I don't recall whether you need the parent or not... *ponder*

hope this helps...
0
 

Expert Comment

by:matzon
ID: 1163002
... Ofcourse you have to call the ShowWindow() too. :)
0
 

Author Comment

by:Imran020598
ID: 1163003
Hello Matzon,
This did not solve my problem. It seems to me that when the create function is called the assertion error is displayed. From what I know, I don't need to call the create function (although I have tried) because this is called by MFC itself!
From what I have found out, It does not seem to be possible to create a dialogbox in a dialogbased application with the base class as CRecordview.
0
 

Accepted Solution

by:
matzon earned 20 total points
ID: 1163004
achh...
My fault.... You can't create a dialog that uses a CRecordView, since a View is only used in a SDI or MDI application!

So what you want to do, is to start a new application workspace and choose either SDI or MDI instead of dialog. Include header files (or choose to have with/without file support).
At the last page of the wizard, change your view to CRecordView.
That Should do it...
If you do want to show database data in a dialog you have to manually insert the data from the database in some of the editfields(or whatever) that you have create. If this doesn't work Could you then supply a more specific question, or mail me the sample app and database then i'll have a looksee
btw: are you using ODBC?
0
 

Author Comment

by:Imran020598
ID: 1163005
Hello Matzon,
Thnx for your help, but actually I knew that a View class can only be used in a SDI or MDI application. But I was hoping for some dirty work arround so that it could be used in a dialog-based application. Anyway thnx for the effort and your time!
Regards
Imran
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now