Solved

Showing a CRecordView Dialog

Posted on 1998-05-18
5
376 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

756 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