Edit Control Getting NULLed 
Author Message
 Edit Control Getting NULLed

Hi all,

I have a strange problem that is occurring with a simple
CRecordset owned by a CRecordView object.

The CRecordView object displays a form designed to allow
the user to enter a new record into a database.  There are
a total of six control boxes on the form (three edit
boxes, two list boxes, and one combo box).

Two of the edit boxes are "read-only" - the program
computes both the problem number and timestamp, and does
not allow the user to change these values.  The problem
number is also the primary key for the database being
accessed.

The program logic is very simple:

1. the recordset is opened (only once via OnGetRecordSet().
2. AddNew() is called.
3. recordset data members and form controls are
   initialized.
4. the form is displayed via CRecordView::OnInitialUpdate()
5. user inputs information and clicks the "post" button.
6. OnPost() calls UpdateData(TRUE) to read the data from
   the form controls, and move it to the recordset data
   members.
7. Update() is called to post the record to the database.
8. Steps 2 thru 7 are repeated until the user cancels or
   exits the program.

Here's the problem part:  somehow between steps 3 and 4,
the problem number is getting trashed - meaning it
displays as blank on the form.  All other controls are
fine - even the timestamp, which is the only other read-
only value.  

When I look at the values of the recordset data members in
Debug, everything looks fine except for the problem number
field.  Interestingly, it is getting reset to the "no
value" type NULL generally attributed to the AddNew()
action.  Consequently, when the form is displayed, the
problem number edit control shows a blank to the user.

With the program at a breakpoint, I can manually add a
problem number, continue the program and it will post the
record to the database just fine.  The program then loops
back ready for the user to enter another record just as
its designed to do.

My question:  has anyone ever seen this type of problem
before?  It seems odd to me that the only field getting
blitzed is the problem number, which also happens to be
the key field for the database - although I'm not sure if
this is a causitive factor.

Any help would be greatly appreciated.  Thank you!

RN



Sat, 21 Aug 2004 01:44:51 GMT  
 Edit Control Getting NULLed
I couldn't repro it since having no sample. My suggetion is to watch the
value of it before and after step 1, 2 and 3 to make sure that its value is
correct.

Best regards,
yhhuang
VS.NET, Visual C++
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com



Sat, 21 Aug 2004 15:58:38 GMT  
 Edit Control Getting NULLed
Hi Yan-Hong,

Thank you for your help.  I've used the de{*filter*} to step
through each part of the code, and the value changes just
before the form becomes visible to the user.  Very wierd.

I'm sending a code sample below.  Here's a quick overview
of how the program works in general:

The main view is a CRecordView object, that simply
displays records from the selected table in the database.  
The framework handles the record scrolling action.  The
view form provides the user with three buttons - Edit,
Add, and Exit.  

If the user clicks on edit, the message is handled in the
main view as follows:

void CTraxCEpcView::OnEdit()
{
//first, let's make sure we can update the recordset
if(m_pSet->CanUpdate())
{
        try
        {
                        //begin the update              
        m_pSet->Edit();

        }

        catch (CException* pEx)
        {
        pEx->ReportError();
        }

Quote:
}

else
        AfxMessageBox("Recordset cannot be updated!");

((CMainFrame*)GetParentFrame())->SelectView(EDITCALL_VIEW);

Quote:
}

In this situation, the edit view is using the same
recordset as the main view.  This allows me to edit the
exact record the user is viewing when they click the edit
button from the main view form without creating a new
recordset object, opening it, and repositioning the
record.  When the user is done, he can click the apply
button from the edit view form to apply the changes to the
record, or click cancel to return to the main view.  This
part works fine.  Note that the problem number and
timestamp fields remain read-only in the edit view as well.

If the user clicks add from the main view form, the
following code is executed:

void CTraxCEpcView::OnAdd()
{

((CMainFrame*)GetParentFrame())->SelectView(ADDCALL_VIEW);

Quote:
}

In the add view, I use a separate recordset object, so I
have to wait to call the AddNew() function from within the
add view object.  I do this because of the way the
recordset edit buffer is handled by AddNew(); I found it
was easier to just have a distinct recordset.

Here's the SelectView() code.  This is located in the main
frame object:

void CMainFrame::SelectView(UINT ViewID)
{

//this member function is used to switch to different views

//there are three things we must do when switching views:
//
// 1)  get pointers to the current view and the new view
//2)  create the new view if it doesn't exist
//3) swap the new view in place of the old view, while
//preserving the old view info so it can be restored when
//selected.

//save the current ViewID
m_PreviousViewID = m_CurrentViewID;

//get the current view
CView* pOldActiveView = GetActiveView();

//get a pointer to the new view if it exits; if it
//doesn't the pointer will be null, so we'll have to
//create a new one; note that GetDlgItem is a member
//function of CWnd, so we can use it here; we need to
//cast the return value from CWnd* to CView*

CView* pNewActiveView = (CView*)GetDlgItem(ViewID);

//if this is the first time around for this view, we will
// need to create it
if(pNewActiveView == NULL)
{
        switch(ViewID)
        {
        case ADDCALL_VIEW:
        //create the new view object
        pNewActiveView = (CView*)new CAddCallView;
        break;

        case EDITCALL_VIEW:
        //create the new view object
        pNewActiveView = (CView*)new CEditCallView;
        break;

        default:
        AfxMessageBox("Invalid View ID");
        return;
        }

//obtain the current document context to apply to the new
//view
       CCreateContext context;
       context.m_pCurrentDoc =
                           pOldActiveView->GetDocument();

//now create the view
      pNewActiveView->Create(NULL,NULL,0L,
             CFrameWnd::rectDefault,this,ViewID,&context);

        pNewActiveView->OnInitialUpdate();

Quote:
}

//hide the old view
pOldActiveView->ShowWindow(SW_HIDE);
//show the new view
pNewActiveView->ShowWindow(SW_SHOW);

//set the old view ID
pOldActiveView->SetDlgCtrlID(m_CurrentViewID);
pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);

//save the new view ID
m_CurrentViewID = ViewID;

//reset the change mode flag
m_bDisplayMode = !m_bDisplayMode;

//set the frame title
SetFrameTitle();

//activate the new view
SetActiveView(pNewActiveView);

Quote:
}

****************************************************
OK, here's the add view code that's causing all the
trouble:

// AddCallView.cpp : implementation file
//

#include "stdafx.h"
#include "TraxCEpc.h"
#include "AddCallView.h"

#include "TraxCEpcSet.h"
#include "TraxCEpcDoc.h"

#include "TraxCEpcConstants.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

///////////////////////////////////////////////////////////
//////////////////
// CAddCallView

IMPLEMENT_DYNCREATE(CAddCallView, CRecordView)

CAddCallView::CAddCallView()
        : CRecordView(CAddCallView::IDD)
{
        //{{AFX_DATA_INIT(CAddCallView)
        m_pSet = NULL;
        //}}AFX_DATA_INIT
        m_lNewProblemNumber = 0;

Quote:
}

CAddCallView::~CAddCallView()
{

        if (m_pSet)
                delete m_pSet;

Quote:
}

void CAddCallView::DoDataExchange(CDataExchange* pDX)
{
        CRecordView::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CAddCallView)
        DDX_Control(pDX, IDC_ADDPROBLEMNUMBER,
m_AddProblemNumberControl);
        DDX_Control(pDX, IDC_ADDTIMESTAMP,
m_AddTimestampControl);
        DDX_Control(pDX, IDC_ADDPRIORITY,
m_AddPriorityControl);
        DDX_Control(pDX, IDC_ADDRESOLUTION,
m_AddResolutionControl);
        DDX_Control(pDX, IDC_ADDSUBJECT,
m_AddSubjectControl);
        DDX_Control(pDX, IDC_ADDSTATUS,
m_AddStatusControl);
        DDX_FieldLBString(pDX, IDC_ADDSTATUS, m_pSet-
Quote:
>m_Status, m_pSet);

        DDX_FieldLBString(pDX, IDC_ADDPRIORITY, m_pSet-
Quote:
>m_Priority, m_pSet);

        DDX_FieldText(pDX, IDC_ADDSUBJECT, m_pSet-
Quote:
>m_Subject, m_pSet);

        DDX_FieldCBString(pDX, IDC_ADDRESOLUTION, m_pSet-
Quote:
>m_Resolution, m_pSet);

        DDX_FieldText(pDX, IDC_ADDTIMESTAMP, m_pSet-
Quote:
>m_Timestamp, m_pSet);

        DDX_FieldText(pDX, IDC_ADDPROBLEMNUMBER, m_pSet-

Quote:
>m_Problem_Number, m_pSet);
        //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAddCallView, CRecordView)
        //{{AFX_MSG_MAP(CAddCallView)
        ON_BN_CLICKED(IDC_EXIT, OnExit)
        ON_BN_CLICKED(IDC_POST, OnPost)
        ON_BN_CLICKED(IDC_CANCEL, OnCancel)
        ON_UPDATE_COMMAND_UI(ID_RECORD_FIRST,
OnUpdateRecordFirst)
        ON_UPDATE_COMMAND_UI(ID_RECORD_LAST,
OnUpdateRecordLast)
        ON_UPDATE_COMMAND_UI(ID_RECORD_NEXT,
OnUpdateRecordNext)
        ON_UPDATE_COMMAND_UI(ID_RECORD_PREV,
OnUpdateRecordPrev)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

///////////////////////////////////////////////////////////
//////////////////
// CAddCallView diagnostics

#ifdef _DEBUG
void CAddCallView::AssertValid() const
{
        CRecordView::AssertValid();

Quote:
}

void CAddCallView::Dump(CDumpContext& dc) const
{
        CRecordView::Dump(dc);
Quote:
}

#endif //_DEBUG

///////////////////////////////////////////////////////////
//////////////////
// CAddCallView message handlers

CRecordset* CAddCallView::OnGetRecordset()
{
        if (m_pSet != NULL)
                return m_pSet;

        m_pSet = new CTraxCEpcSet(NULL);
        m_pSet->m_strSort = "[Problem Number]";
        m_pSet->Open();

        return m_pSet;

Quote:
}

CTraxCEpcSet* CAddCallView::GetRecordset()
{

        CTraxCEpcSet* pData = (CTraxCEpcSet*)
OnGetRecordset();
        ASSERT(pData == NULL || pData->IsKindOf
(RUNTIME_CLASS(CTraxCEpcSet)));
        return pData;

Quote:
}

void CAddCallView::OnInitialUpdate()
{
        //this method is called by the framework after the
view is attached to the document
        //but before the view is displayed; note that it
is only called the first time
        //after the view is created; put
any "reactivation" or recurring initialization
        //in OnActivateView()

        //note:  use Begin/EndWaitCursor() as appropriate -
 there may be initializing
        //tasks that will require time.

        //BeginWaitCursor();

        //initialize the document pointer
        m_pDoc = (CTraxCEpcDoc*)GetDocument();

        CRecordView::OnInitialUpdate();

        //EndWaitCursor();

Quote:
}

void CAddCallView::OnPost()
{

        //read the changes from the dialog
        UpdateData(TRUE);

//first, let's make sure we can add to the recordset;
if(m_pSet->CanAppend())
        {
                try
                {
                        //complete the add
                        m_pSet->Update();

                }

                catch (CException* pEx)
                {
                        //an error occurred in starting
the update process, so display the message
                        pEx->ReportError();
                }
        }
        else
                AfxMessageBox("Record cannot be Added!");

        //refresh the recordset
        m_pSet->Requery();

        //reinitialize the controls
        InitializeControls();

        //initialize the view
        CRecordView::OnInitialUpdate();

Quote:
}

void CAddCallView::OnExit()
{
        m_pSet->CancelUpdate();      //cancel the addnew
operation
        PostQuitMessage(0);  //bail out

Quote:
}

void CAddCallView::OnCancel()
{

        //cancel the addnew operation
        m_pSet->CancelUpdate();      
        ((CMainFrame*)GetParentFrame())->SelectView
(RECORD_VIEW);

Quote:
}

void CAddCallView::OnActivateView(BOOL bActivate, CView*
pActivateView, CView* pDeactiveView)
{

        // we must place these calls here rather than in
OnInitialUpdate()
        //because OnActivateView() is called every time.
        GetParentFrame()->RecalcLayout();
        ResizeParentToFit();

        //me need a pointer to the main frame so we can
access the m_bDisplayMode member; this
        //tells us whether we should turn the record
first/next/prev/last menu/tool controls
        //on or off
        m_pMainFrame = (CMainFrame*)GetParentFrame();

        if(bActivate)
        {

                //initialize  all the edit controls - this
includes the list and combo boxes
                InitializeControls();

                CRecordView::OnInitialUpdate();

        }

        CRecordView::OnActivateView(bActivate,
pActivateView, pDeactiveView);

Quote:
}

//***************************  Initialize the add call
view controls ****************
void CAddCallView::InitializeControls()
{
        //populate the controls; this is a new record, so
we will use defaults

        //*************************************************
*********
        SetAddNew();

        //*************************************************
************************

        m_pSet->m_OID = 0;

        //get a new problem number
        m_lNewProblemNumber = GetNewProblemNumber();
        m_pSet->m_Problem_Number = m_lNewProblemNumber;

        //get the timestamp
        m_pSet->m_Timestamp = GetTimeStamp();

        //initialize the controls
        m_AddStatusControl.ResetContent();
...

read more »



Sun, 22 Aug 2004 01:23:35 GMT  
 Edit Control Getting NULLed
Apparently the whole message didn't go through.  I'm
resending the add view implementation code here:

// AddCallView.cpp : implementation file
//

#include "stdafx.h"
#include "TraxCEpc.h"
#include "AddCallView.h"

#include "TraxCEpcSet.h"
#include "TraxCEpcDoc.h"

#include "TraxCEpcConstants.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

///////////////////////////////////////////////////////////
//////////////////
// CAddCallView

IMPLEMENT_DYNCREATE(CAddCallView, CRecordView)

CAddCallView::CAddCallView()
        : CRecordView(CAddCallView::IDD)
{
        //{{AFX_DATA_INIT(CAddCallView)
        m_pSet = NULL;
        //}}AFX_DATA_INIT
        m_lNewProblemNumber = 0;

Quote:
}

CAddCallView::~CAddCallView()
{

        if (m_pSet)
                delete m_pSet;

Quote:
}

void CAddCallView::DoDataExchange(CDataExchange* pDX)
{
        CRecordView::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CAddCallView)
        DDX_Control(pDX, IDC_ADDPROBLEMNUMBER,
m_AddProblemNumberControl);
        DDX_Control(pDX, IDC_ADDTIMESTAMP,
m_AddTimestampControl);
        DDX_Control(pDX, IDC_ADDPRIORITY,
m_AddPriorityControl);
        DDX_Control(pDX, IDC_ADDRESOLUTION,
m_AddResolutionControl);
        DDX_Control(pDX, IDC_ADDSUBJECT,
m_AddSubjectControl);
        DDX_Control(pDX, IDC_ADDSTATUS,
m_AddStatusControl);
        DDX_FieldLBString(pDX, IDC_ADDSTATUS, m_pSet-
Quote:
>m_Status, m_pSet);

        DDX_FieldLBString(pDX, IDC_ADDPRIORITY, m_pSet-
Quote:
>m_Priority, m_pSet);

        DDX_FieldText(pDX, IDC_ADDSUBJECT, m_pSet-
Quote:
>m_Subject, m_pSet);

        DDX_FieldCBString(pDX, IDC_ADDRESOLUTION, m_pSet-
Quote:
>m_Resolution, m_pSet);

        DDX_FieldText(pDX, IDC_ADDTIMESTAMP, m_pSet-
Quote:
>m_Timestamp, m_pSet);

        DDX_FieldText(pDX, IDC_ADDPROBLEMNUMBER, m_pSet-

Quote:
>m_Problem_Number, m_pSet);
        //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAddCallView, CRecordView)
        //{{AFX_MSG_MAP(CAddCallView)
        ON_BN_CLICKED(IDC_EXIT, OnExit)
        ON_BN_CLICKED(IDC_POST, OnPost)
        ON_BN_CLICKED(IDC_CANCEL, OnCancel)
        ON_UPDATE_COMMAND_UI(ID_RECORD_FIRST,
OnUpdateRecordFirst)
        ON_UPDATE_COMMAND_UI(ID_RECORD_LAST,
OnUpdateRecordLast)
        ON_UPDATE_COMMAND_UI(ID_RECORD_NEXT,
OnUpdateRecordNext)
        ON_UPDATE_COMMAND_UI(ID_RECORD_PREV,
OnUpdateRecordPrev)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

///////////////////////////////////////////////////////////
//////////////////
// CAddCallView diagnostics

#ifdef _DEBUG
void CAddCallView::AssertValid() const
{
        CRecordView::AssertValid();

Quote:
}

void CAddCallView::Dump(CDumpContext& dc) const
{
        CRecordView::Dump(dc);
Quote:
}

#endif //_DEBUG

///////////////////////////////////////////////////////////
//////////////////
// CAddCallView message handlers

CRecordset* CAddCallView::OnGetRecordset()
{
        if (m_pSet != NULL)
                return m_pSet;

        m_pSet = new CTraxCEpcSet(NULL);
        m_pSet->m_strSort = "[Problem Number]";
        m_pSet->Open();

        return m_pSet;

Quote:
}

CTraxCEpcSet* CAddCallView::GetRecordset()
{

        CTraxCEpcSet* pData = (CTraxCEpcSet*)
OnGetRecordset();
        ASSERT(pData == NULL || pData->IsKindOf
(RUNTIME_CLASS(CTraxCEpcSet)));
        return pData;

Quote:
}

void CAddCallView::OnInitialUpdate()
{

        //note:  use Begin/EndWaitCursor() as appropriate -
 there may be initializing
        //tasks that will require time.

        //BeginWaitCursor();

        //initialize the document pointer
        m_pDoc = (CTraxCEpcDoc*)GetDocument();

        CRecordView::OnInitialUpdate();

        //EndWaitCursor();

Quote:
}

void CAddCallView::OnPost()
{

        //read the changes from the dialog
        UpdateData(TRUE);

    //first, let's make sure we can add to the recordset;
        if(m_pSet->CanAppend())
        {
                try
                {
                        //complete the add
                        m_pSet->Update();

                }

                catch (CException* pEx)
                {
                        //an error occurred in starting
the update process, so display the message
                        pEx->ReportError();
                }
        }
        else
                AfxMessageBox("Record cannot be Added!");

        //refresh the recordset
        m_pSet->Requery();

        //reinitialize the controls
        InitializeControls();

        //initialize the view
        CRecordView::OnInitialUpdate();

Quote:
}

void CAddCallView::OnExit()
{
        m_pSet->CancelUpdate();      //cancel the addnew
operation
        PostQuitMessage(0);  //bail out

Quote:
}

void CAddCallView::OnCancel()
{

        //cancel the addnew operation
        m_pSet->CancelUpdate();      

        ((CMainFrame*)GetParentFrame())->SelectView
(RECORD_VIEW);

Quote:
}

void CAddCallView::OnActivateView(BOOL bActivate, CView*
pActivateView, CView* pDeactiveView)
{
        //we place these calls here rather than in
OnInitialUpdate()
        //because OnActivateView() is called every time.
        GetParentFrame()->RecalcLayout();
        ResizeParentToFit();

        //me need a pointer to the main frame so we can
access the m_bDisplayMode member; this
        //tells us whether we should turn the record
first/next/prev/last menu/tool controls
        //on or off
        m_pMainFrame = (CMainFrame*)GetParentFrame();

        if(bActivate)
        {

                //initialize  the recordset and all the
edit controls -
                //this includes the list and combo boxes
                InitializeControls();

                CRecordView::OnInitialUpdate();

        }

        CRecordView::OnActivateView(bActivate,
pActivateView, pDeactiveView);

Quote:
}

//***************************  Initialize the add call
view controls ****************
void CAddCallView::InitializeControls()
{
        //populate the controls; this is a new record, so
we will use defaults

        SetAddNew();

        //*************************************************
************************

        m_pSet->m_OID = 0;

        //get a new problem number
        m_lNewProblemNumber = GetNewProblemNumber();
        m_pSet->m_Problem_Number = m_lNewProblemNumber;

        //get the timestamp
        m_pSet->m_Timestamp = GetTimeStamp();

        //initialize the controls
        m_AddStatusControl.ResetContent();
        m_AddPriorityControl.ResetContent();
        m_AddSubjectControl.Clear();
        m_AddResolutionControl.ResetContent();

        //set size limits on the amount of data that can
be entered
        m_AddSubjectControl.SetLimitText(50);
        m_AddResolutionControl.LimitText(50);

        // populate the controls
        m_AddStatusControl.AddString("Accepted");
        m_AddStatusControl.AddString("Assigned");
        m_AddStatusControl.AddString("Closed");
        m_AddStatusControl.AddString("Consult");
        m_AddStatusControl.AddString("Hold");
        m_AddStatusControl.AddString("Open");
        m_AddStatusControl.AddString("Waiting");

        m_AddPriorityControl.AddString("High");
        m_AddPriorityControl.AddString("Medium");
        m_AddPriorityControl.AddString("Low");

        //m_AddResolutionControl.AddString(" ");
        m_AddResolutionControl.AddString("Resolved");
        m_AddResolutionControl.AddString("Repaired");
        m_AddResolutionControl.AddString("Rebooted");
        m_AddResolutionControl.AddString("Reinstalled");
        m_AddResolutionControl.AddString("Replaced");

        //now set the listbox items to default values -
the only controls where the user can
        //type whatever they want is the status edit box
and the resolution
        //combobox - everything else must be selected from
the list/drop down box

        //status

        m_AddStatusControl.SetCurSel(0); //default to
assigned

        //priority

        m_AddPriorityControl.SetCurSel(0); //default to
high

        //resolution

        m_AddResolutionControl.SetCurSel(0);

Quote:
}

//*********************************************************
************************

long CAddCallView::GetNewProblemNumber()
{
        //here is were we will calculate a new problem
number - note that this number is
        //temporary, and is set for DB continuity only;
        //ONLY the Vantive DB can assign permanent problem
numbers

        //this method simply scans the DB for the highest
problem number value, and adds one.
        //we don't really need to worry about making the
number unique relative to Vantive
        //because Vantive will simply read this DB and
create a new problem number before
        //posting the data to its own tables.

        long tempNewProblemNumber = 0;

        //we need an independent recordset to scan for
highest problem numbers;

                m_pSetTwo = new CTraxCEpcSet(NULL);
                m_pSetTwo->m_strSort = "[Problem Number]";
                m_pSetTwo->Open();

        //check to see if we have any records
        if(!(m_pSetTwo->IsBOF() && m_pSetTwo->IsEOF()))
        {
                //we have records, so start at the first
and scan for highest value
                m_pSetTwo->MoveFirst();
                while (!m_pSetTwo->IsEOF())
                {
                        //save the problem number if it is
larger
                        if(tempNewProblemNumber <
m_pSetTwo->m_Problem_Number)
                                tempNewProblemNumber =
m_pSetTwo->m_Problem_Number;

                        m_pSetTwo->MoveNext(); //go to the
next record
                }

        }

        m_pSetTwo->Close();

        delete m_pSetTwo;

        return ++tempNewProblemNumber;  //add one to the
final result and return it

Quote:
}

void CAddCallView::SetAddNew()
{

        //first, let's make sure we can add to the
recordset
        if(m_pSet->CanAppend())
        {
                try
                {
                        //begin the update process;  at
this point the current record in the edit buffer
                        //is stored by the framework, so
its contents can be restored if the operation is
                        //cancelled; field data members
are flagged so it will be possible to detect changes
                        //in them later - they are also
marked "clean" (unchanged) and set to a Null;
                        //After the call to AddNew(), the
edit buffer represents a new empty record, ready
                        //to be filled in with values; to
do this, you must then set the values by
                        //assigning to them; then you call
Update() to commit the new record to the DB.
                        m_pSet->AddNew();

                }

                catch (CException* pEx)
                {
                        //an error occurred in starting
the update process, so display the message
                        pEx->ReportError();
                }
        }
        else
                AfxMessageBox("Recordset cannot be
updated!");

Quote:
}

//*********************************************************
*********
//here's where we disable the menu/tool controls that
allow us to move
//through the recordset.  In add mode, we can't allow the
user to
//move around in the DB!!!

void CAddCallView::OnUpdateRecordFirst(CCmdUI* pCmdUI)
{
        pCmdUI->Enable(m_pMainFrame->m_bDisplayMode);

Quote:
}

void CAddCallView::OnUpdateRecordLast(CCmdUI* pCmdUI)
{
        pCmdUI->Enable(m_pMainFrame->m_bDisplayMode);

Quote:
}

void CAddCallView::OnUpdateRecordNext(CCmdUI* pCmdUI)
{
        pCmdUI->Enable(m_pMainFrame->m_bDisplayMode);

Quote:
}

void CAddCallView::OnUpdateRecordPrev(CCmdUI* pCmdUI)
{
        pCmdUI->Enable(m_pMainFrame->m_bDisplayMode);
...

read more »



Sun, 22 Aug 2004 02:17:42 GMT  
 Edit Control Getting NULLed

Sorry - the code sample is too large to send in one
piece.  I've attached a txt file instead.  Let me know if
it comes through OK.  Thanks!!

RN

Quote:
>-----Original Message-----
>I couldn't repro it since having no sample. My suggetion
is to watch the
>value of it before and after step 1, 2 and 3 to make sure
that its value is
>correct.

>Best regards,
>yhhuang
>VS.NET, Visual C++
>Microsoft

>This posting is provided "AS IS" with no warranties, and
confers no rights.
>Got .Net?  http://www.gotdotnet.com

>.

  sampleaddcallview.txt
10K Download


Sun, 22 Aug 2004 02:24:11 GMT  
 Edit Control Getting NULLed
Hi,

I suggest you refer to the ENROLL sample in MSDN. It describes the detailed
way to add/remove records in DB. And the structure of this sample is very
clear.

It is hard to analysis the problem without repro sample.

Best regards,
yhhuang
VS.NET, Visual C++
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com



Sun, 22 Aug 2004 17:55:37 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Edit Box Getting NULLed

2. Method of Getting Handle of Edit Control Associated with Combo Box Control

3. Edit Control...Edit Control...Edit Control...Edit Control...Edit Control...

4. Getting the Handle to Edit control of ComboBox

5. Getting selection in Edit control into buffer...

6. newbie getting started with edit controls that work in XP

7. Horrible Newbie Question - Getting Numbers from Edit Controls

8. Edit Control not getting updated

9. HOW Getting SCROLL RECT of the EDIT CONTROL?

10. CComboBox: Getting Text from the Edit Control

11. Getting text from an edit Control

12. Edit Control---- Edit control ----------------------

 

 
Powered by phpBB® Forum Software