Hello! You cannot call the 'GetDocument()' function of a view before you call 'CRecordView::OnInitialUpdate()'. Your program crashes because GetDocument() does not know what to return. Let me quickly explain. The CRecordView::OnInitialUpdate function hooks your view into the document, so that you can always retreive the associated document with GetDocument(). If you try and call GetDocument() before that, it will probably return NULL, giving you an 'Unhandled exception' (trying to access something in a NULL pointer). So, you code should look something like this (minus the comments, of course, which just explain what I'm doing):
void CMgen1View::OnInitialUpdate()
{
//Always call this before calling GetDocument:
CRecordView::OnInitialUpdate();
//Now the view is hooked to the document, so get the set:
m\_pSet = GetDocument()->m\_mgen1Set;
LoadListbox();
}
Hope that helps! Sincerely, Alexander Wiseman Est melior esse quam videri It is better to be than to seem